zxo102 wrote: > Hi, > I am trying to use python module smtplib to send my email out on > window xp (localhost). > > import smtplib > server = smtplib.SMTP('localhost') > > but I got the error information as follows: > > Traceback (most recent call last): > File "<interactive input>", line 1, in ? > File "c:\python24\lib\smtplib.py", line 244, in __init__ > (code, msg) = self.connect(host, port) > File "c:\python24\lib\smtplib.py", line 311, in connect > (code, msg) = self.getreply() > File "c:\python24\lib\smtplib.py", line 355, in getreply > raise SMTPServerDisconnected("Connection unexpectedly closed") > SMTPServerDisconnected: Connection unexpectedly closed > > I am not sure what is wrong with it. Should I configure my window xp > somewhere to run smtplib.SMTP('localhost')? > > Thanks in advance. > Well your code certainly expects *something* to be listening on port 25 on localhost. It's fairly unusual to run an SMTP server on Windows XP, though not impossible.
usually your email system is set up to use some external host as uts SMPT server: if you look in your mail client's configuration you will probably find out whihc host you should be using. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list