Python cannot use SMTP...

Peter Hansen peter at engcorp.com
Wed Sep 1 09:31:23 EDT 2004


JZ wrote:

> Wed, 01 Sep 2004 08:33:51 -0400, na comp.lang.python, Peter Hansen
> napisał(a):
>>The first three characters are the critical part.  If they aren't
>>a three-digit SMTP response code, your server is likely borken.
>>If you post the results, someone might have some advice, but it's
>>not likely this is a Python issue.
> 
> via telnet localhost 25:
> ...
> Connected to localhost.
> Escape character is '^]'.
> db_connect: failed to connect to database: Error: Access denied for user:
> 'admin at localhost' (Using password: YES)
> 220 NS1.4U2.PL ESMTP
> 
> Strange, because I can send emails from bash using mail command. I can send
> email with php scripts as well (using mail() function). php.ini file has
> empty settings for SMTP, so it uses default system settings... 

I expect other tools are being more lenient, ignoring each line that
doesn't look like a proper SMTP reply until they find one that does.
That doesn't mean the smtplib approach is wrong, mind you...

It would be pretty easy to hack your local smtplib.py to skip over that
junk, if you were so inclined.

Probably even easier just to fix the server...

-Peter



More information about the Python-list mailing list