By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,221 Members | 1,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,221 IT Pros & Developers. It's quick & easy.

smtplib error('Connection reset by peer')

P: n/a
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('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?

Jan 4 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I should mention that I'm on Windows XP.

Jan 5 '06 #2

P: n/a
Do you actually run an SMTP server on your local machine and is it
configured to accept mail on the localhost interface and does it allow
mail forwarding such as you attempted?

LL

Jan 7 '06 #3

P: n/a
"Van_Gogh" <Te*****@gmail.com> wrote:

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:
...
error: (10054, 'Connection reset by peer')

Anyone got a pointer as to what I could do?


Replace "localhost" with the name of your usual outgoing mail server.

Although there ARE SMTP servers available for Windows XP, is it virtually
certain that you aren't running one.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jan 8 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.