intermittent smtp module problems (with sendmail) in python 2.2.1
karlehr at gmail.com
Thu Aug 5 21:45:45 CEST 2004
Christopher T King <squirrel at WPI.EDU> wrote in message news:<Pine.LNX.4.44.0408041442380.14974-100000 at ccc9.wpi.edu>...
> On 4 Aug 2004, Karl Ehr wrote:
> > I have written the following simple program to monitor a single URL,
> > and notify me via email whenever this URL changes. Intermittently,
> > I raise the following exception:
> > smtplib.SMTPServerDisconnected: Connection unexpectedly closed
> This is probably happening because of a timeout on the SMTP server. Try
> moving this line:
> > server = smtplib.SMTP('localhost') # server to relay smtp through for
> To right in front of where you use it:
> > server.set_debuglevel(1)
> > server.sendmail(sourceAddress, emailAddress, message)
> > server.quit()
> the SMTP() constructor doesn't just set up a connection (and open it on
> .sendmail()); it opens the connection when it's called and leaves it open
> until you call .quit() (or delete the object).
Aha!! Thank you this works fine now... I'll keep that snag in mind
when referencing other "external" apps in the future...
More information about the Python-list