smtplib error('Connection reset by peer')

Van_Gogh Terji78 at gmail.com
Wed Jan 4 18:47:34 EST 2006


Hi,

I am learning how to use the smtplib module, but am having some very
early problems, maybe because I don't understand it.
So, am I correct that by following the example in the Python:

>>> import smtplib
>>> server = smtplib.SMTP('localhost')
>>> server.sendmail('soothsayer at example.org', 'jcaesar at example.org',
"""To: jcaesar at example.org
From: soothsayer at example.org

Beware the Ides of March.
""")
>>> server.quit()

I should be able to send an email to the recipient, in this case
jcaesar at example.org? When I try to create the server(the line 'server =
smtplib.SMTP('localhost')) I get the following error message:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in -toplevel-
    server = smtplib.SMTP('localhost')
  File "C:\Python24\lib\smtplib.py", line 241, in __init__
    (code, msg) = self.connect(host, port)
  File "C:\Python24\lib\smtplib.py", line 304, in connect
    (code, msg) = self.getreply()
  File "C:\Python24\lib\smtplib.py", line 345, in getreply
    line = self.file.readline()
  File "C:\Python24\lib\socket.py", line 340, in readline
    data = self._sock.recv(self._rbufsize)
error: (10054, 'Connection reset by peer')

Anyone got a pointer as to what I could do?




More information about the Python-list mailing list