Welcome Guest, Not a member yet? Register   Sign In
E-mail library not properly sending AUTH LOGIN
#1

[eluser]mscahill[/eluser]
I'm attempting to send e-mail through an authenticated SMTP server with CI's e-mail library. I've successfully sent an e-mail with fsockwrite, but cannot do so with CI. Here is the error I get when trying to send an e-mail:

hello: The following SMTP error was encountered: Failed to send AUTH LOGIN command. Error:
from: The following SMTP error was encountered:
to: The following SMTP error was encountered:
data: The following SMTP error was encountered:
451 4.7.0 Timeout waiting for client input
The following SMTP error was encountered:
451 4.7.0 Timeout waiting for client input

Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

Any ideas? I can't seem to isolate the point at which the error occurs. Perhaps it's extra characters after the HELO or something...
#2

[eluser]mscahill[/eluser]
So it appears as if CI is getting no response from EHLO. In fact, CI doesn't even wait for a response from EHLO. When it tries to send AUTH LOGIN, though, it still gets no response. Could this be an e-mail configuration problem? Line ending problem? Timing problem?
#3

[eluser]sophistry[/eluser]
it can help to post code.
#4

[eluser]mscahill[/eluser]
I figured it out right before lunch. I had set the configuration wrong. I had:

Code:
$config['crlf'] = '\r\n';
$config['newline'] = '\r\n';

instead of:

Code:
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
#5

[eluser]whobutsb[/eluser]
Oh wow this is awesome! Thank you so much for posting that change. I've been trying everything to figure out what was wrong with the SMTP mail!!!

Thank you!
#6

[eluser]bhensonweb[/eluser]
I had this problem as well, and this fixed it!

I have been in the habit of using the single quotations for string variables, maybe I should change...

This was the returned error:

451 See http://pobox.com/~djb/docs/smtplf.html.
The following SMTP error was encountered: 451 See http://pobox.com/~djb/docs/smtplf.html.
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

Thanks.
#7

[eluser]sophistry[/eluser]
using single-quotes for putting strings into variables is a good habit, don't change.

single-quotes are faster.
they are easier to read.
they tell other programmers (who may read your code) that you don't intend the string to be parsed for variables.

double-quotes tells PHP to look at the string and swap in any variables.

in this case, (special chars CR LF TAB etc..) you NEED to put them in double-quotes so that PHP "interprets" them correctly.

just remember: always use double-quotes for the special chars: "\n\r\t" (note: this is not an exhaustive list, just the most common)




Theme © iAndrew 2016 - Forum software by © MyBB