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('s*********@example.org', 'j******@example.org', """To: jc*****@example.org
From: so********@example.org
Beware the Ides of March.
""") server.quit()
I should be able to send an email to the recipient, in this case
jc*****@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?