sending of mail (smtp) - connection refused - but smtp server is

Peter Hansen peter at engcorp.com
Tue Jun 29 16:36:30 CEST 2004


Alex Hunsley wrote:

> I am failing with "connection refused" error, even though we definitely 
> have an smtp server running on port 25!
...
> any ideas what the problem could be? this usually happens when someone 
> is not aware they have to run an SMTP server, but we do have one 
> running, as can be seen above!

Not sure, but please try this at the interactive prompt and report
(or analyze) what it returns:

 >>> from socket import *
 >>> getaddrinfo('192.168.1.105', 25, 0, SOCK_STREAM)


This is something that smtplib.py is actually doing to get the
host:port combination that it uses to connect.  It seems that
the only possible source for the failure you see is if it
does not return the expected values.

-Peter



More information about the Python-list mailing list