Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Email issues
  • Hello everyone,

    I've been try sent emails through fuelPHP, but the following error is happening:

    fputs(): send of 5 bytes failed with errno=32 Broken pipeUncaught exception Fuel\Core\PhpErrorException: 8 - fputs(): send of 5 bytes failed with errno=32 Broken pipe in /var/www/html/spc/fuel/packages/email/classes/email/driver/smtp.php on line 274
    Callstack:

    Does anyone have any idea about what is happening?

    I'm using FuelPHP 1.8.1

    Best regards,
  • HarroHarro
    Accepted Answer
    That usually happens when the remote closes the connection, so fputs() tries to write to a connection that is no longer there.

    You need to debug to figure out what is causing it, could be anything from a problem with the mailserver to using \r\n while the mailserver needs \n or vice-versa.
  • I have tested SwiftMailer class, and everythings went right, but it was necessary to do the following configuration :
                          $confing['ssl']['verify_peer'] = false;
                          $confing['ssl']['verify_peer_name'] = false;

    I'd like to know if it is possible to the same in fuelPHP ?

    Thanks very much,


    Best regards

  • HarroHarro
    Accepted Answer
    If you need to do that, the mailserver you connect to had either an invalid or a self-signed SSL certificate. Usually not a good idea. ;)

    Can you try and see if this fixes it? https://bin.fuelphp.com/snippet/view/OA

    If so, I'll add this as configuration items.
  • Hi Harro, thank you for your response,

    I haven't been able to send email from localhost, so when trying to do so using swiftMailer applying  the configurations mentioned it worked fine. It was necessary to do so in order  to be able to send email locally.

    When trying to do so when using fuelPHP it just didn't work, because I'm sending it from my local host.
    I have tried sending email using the configurations you told me to do but I got the following message:

    'Got an unexpected response from host on command: [.] expecting: 250 received'.

    I'm trying to debug the smtp response.

    Thank you very  much
  • HarroHarro
    Accepted Answer
    Odd, no response after sending the email (the dot command means end-of-data).

    What smtp server are you communicating with? Is the line-end ( \n vs \r\n ) set correctly for that mailserver?
  • I'm communicating with gmail smtp. Back in 2015 I used to use FuelPHP 1.7 and was able to send emails.
    I'm currently using the same email account and the same FuelPHP configurations, including the line-end configuration.
    I tried using FuelPHP 1.7(I got the same message previously mentioned)

    The only way it worked for me was using  SwiftMailer with the configuration I mentioned.

    Thank you very much.

  • HarroHarro
    Accepted Answer
    Google uses TLS encryption, but I doubt they use an invalid or self-signed certificate. 

    Rather, I think you have an issue with your server not being able to verify the certificate.In which case disabling "verify peer" should work fine.

    In the error message

    'Got an unexpected response from host on command: [.] expecting: 250 received'.

    it should have a colon after "received", followed by the response it did receive from the server.  If nothing was received it should have triggered a timeout exception.
  • Hello,
    Long time since my last message.
    I have recently tested the alterations you told to do (https://bin.fuelphp.com/snippet/view/OA) and it worked like charm.

    The only alteration I had to do was in new_line parameter in email config, i'm using '\r\n' for now. Because of that I removed swiftMailer  library from my project.

    Thanks a lot for your help and I belive the configuration done here(https://bin.fuelphp.com/snippet/view/OA) would be of great help.
  • HarroHarro
    Accepted Answer
    Thanks for the feedback, I'll add it to the todo list.
  • HarroHarro
    Accepted Answer
    A permanent solution for this is already implemented, through the smtp options array in the config.

    The settings from the example code translate to this config:

        'options'  => array(
            'ssl' => array(
                'allow_self_signed' => false,
                'verify_peer' => false,
                'verify_peer_name' => false,
            ),
        ),

  • Hello Harro,

    Thank you very much this will help a lot for sure.

    Sorry for the delay in the response.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion