Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Error with email packaging
  • I am trying to use email package of fuelphp. I keep getting this error:

    Email\SmtpCommandFailureException [ Error ]:
    Got an unexpected response from host on command: [QUIT] expecting: 221 received:

    As
    per your comment in some discussion I changed newline="\r\n". then the
    page shows empty but email is not delivered. I use smtp server. Please
    help me. this is urgent.
  • When an email client sends the SMTP command "QUIT", the server should return with "221 Bye" or some other text before closing the connection. The Email class expects that, but appearently there are mailservers (qmail is an example) that can't be bothered and simply close the connectvion.

    If you are on 1.9/develop, update your local code base. If not, migrate your email package to 1.9/develop. If you can't, apply this hotfix to the version you have currently installed: https://github.com/fuel/email/commit/2eab3974e4c38b9fea0a7ebbad3d4e1f20076448
  • Hi Harro,

    Thank you. I am on 1.9/develop. I did the hot fix as you suggested and now I get this error:

    Email\SmtpCommandFailureException [ Error ]:
    Got an unexpected response from host on command: [HELO web135] expecting: 250 received:
  • Which mailserver are you communicating with? Is that a public one I can test with?
  • I am using smtp server. No it is not public.
  • There seems to be clearly something wrong with it, as it doesn't send any response to commands.
     
    You might want to add some debugging to smtp_get_response() to log exactly what the server responds to each command.

    And as it is not public, could you run a manual test (see https://www.port25.com/how-to-check-an-smtp-connection-with-a-manual-telnet-session-2/, starting from the telnet command) and post the result of the entire commandline session here (obscure hostnames or IP adresses if you want)?
  • I tried to debug at smtp_get_response():

    When I print $data: it says SMTP MAIL Service ready
  • Without a number in front of it? What is this for mailserver? Do you know?

    That looks like a Microsoft Exchange server, but that should reply
    "220 mail.example.com Microsoft SMTP MAIL Service ready at Wed 5 Oct 2016 17:23:00 +0100"
  • The normal response from a mailserver is:

    Trying 149.202.16.145...
    Connected to mail.flexcoders.co.uk.
    Escape character is '^]'.
    220 mail.flexcoders.co.uk ESMTP Postfix
    EHLO example.org
    250-mail.flexcoders.co.uk

  • I got like you mentioned . I got exactly like "220 mail.example.com Microsoft SMTP MAIL Service ready at Wed 5 Oct 2016 17:23:00 +0100"
  • Then why does smtp_get_response() not return the "220" in your case?

    https://github.com/fuel/email/blob/1.9/develop/classes/email/driver/smtp.php#L335 should strip the first 3 characters from the response and return that, could you do some more debugging and check why that doesn't happen in your case?
  • it returned 220 in my case. I got like below:


    220 mail.example.com Microsoft ESMTP MAIL Service ready at Wed, 5 Oct 2016 15:21:59 -0400
  • Yeah, so that works as advertised. So what is the problem then?
  • Maybe you have an intermittent problem, with a poor response from the mailserver.

    Can you write $data to a logfile, and check the logfile when you have an exception? Then you could see exacty which response is causing it to fail.

Howdy, Stranger!

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

In this Discussion