Socket Timeout and SMTP

Tim Williams listserver at tdw.net
Fri Jul 23 13:59:42 CEST 2004


----- Original Message ----- 
From: "Steve" <lonetwin at gmail.com>


> Hi Tim,
> On Fri, 23 Jul 2004 12:35:03 +0100, Tim Williams <listserver at tdw.net>
wrote:
> > (python newbie)
> >
> > Is it possible to individually set the socket timeout of a connection
> > created by smtplib,  rather than use the socket.setdefaulttimeout()
value
> > used by the rest of the prog/script?
> > def smtp_client(mx, from, to_list, msg):
> >     server = smtplib.SMTP(mx)
>        server.sock.settimeout(XX)

Perfect,  thanks Steve,   I was trying

    server = smtplib.SMTP(mx)
    server.settimeout(XX)

the correct version is now in my code,  tested and working.

> HTH

most certainly did :-)

Tim








More information about the Python-list mailing list