Python cannot use SMTP...

Peter Hansen peter at
Wed Sep 1 14:33:51 CEST 2004

JZ wrote:

> I cannot find out what is the problem with my Python. I cannot join to smtp
> host.
> 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
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python2.3/", 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 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.


More information about the Python-list mailing list