Python cannot use SMTP...

Peter Hansen peter at engcorp.com
Wed Sep 1 08:33:51 EDT 2004


JZ wrote:

> I cannot find out what is the problem with my Python. I cannot join to smtp
> host.
>>python
> 
> Python 2.3.4 (#1, Jun 22 2004, 04:42:42)
> [GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>>import smtplib
>>>>smtplib.SMTP('localhost')
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python2.3/smtplib.py", line 242, in __init__
>     raise SMTPConnectError(code, msg)
> smtplib.SMTPConnectError: (-1, "onnect: failed to connect to database:
> Error: Access denied for user: 'admin at localhost' (Using password: YES)")

This appears to be because your server is responding in a non-standard
way.  The "-1" arises because an improperly formed SMTP response line
was received.

Try connecting using telnet ("telnet localhost 25") and see what you
get.  It should look something like the first line here:

    220 some.host.name blah blah blah

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.

-Peter



More information about the Python-list mailing list