Re: [Tutor] So close! But ... error: (10054, 'Connection reset by peer')

2006-07-16 Thread Michael P. Reilly
You are running on a PC, which doesn't have a SMTP server running on it.  The default hostname for smtplib.SMTP().connect() is to localhost (your own machine).   You will need to find out the hostname of the mail server that your ISP provides.  You probably set it when you set up your email (based on a little research, it looks to be "
smtp.cox.net").  -ArcegeOn 7/16/06, Grady Henry <[EMAIL PROTECTED]> wrote:







I think that I am so close to getting this 
simple program to run correctly:
 
# Import smtplib for the actual sending 
functionimport smtplib
 
# Import the email modules we'll needfrom 
email.MIMEText import MIMEText
 
# Open a plain text file for reading.  For 
this example, assume that# the text file contains only ASCII 
characters.fp = open(r'C:\Documents and 
Settings\User\Desktop\\text3.txt')# Create a text/plain messagemsg = 
MIMEText(fp.read())fp.close()
 
# me == the sender's email address# you == the 
recipient's email addressmsg['Subject'] = 'The contents of %s' % 
'C:\Documents and Settings\User\Desktop\\text3.txt'msg['From'] = '[EMAIL PROTECTED]'
msg['To'] = '[EMAIL PROTECTED]'
 
# Send the message via our own SMTP server, but 
don't include the# envelope header.s = 
smtplib.SMTP()s.set_debuglevel(1)s.connect(host='', 
port=25)__init__(self, host='', port=25, 
local_hostname=None)s.sendmail('[EMAIL PROTECTED]', ['
[EMAIL PROTECTED]'], 
msg.as_string())s.quit()s.close()
 
But when I run it using IDLE, I get the 
following:
 
 
IDLE 1.1.3   No 
Subprocess >>> connect: ('', 25)connect: ('', 
25)Traceback (most recent call last):  File "C:\Documents and 
Settings\User\Desktop\textsender.py", line 24, in ?    
s.connect(host='', port=25)  File "C:\Python24\lib\smtplib.py", line 
307, in connect    (code, msg) = self.getreply()  
File "C:\Python24\lib\smtplib.py", line 348, in getreply    
line = self.file.readline()  File "C:\Python24\lib\socket.py", line 
340, in readline    data = 
"">error: (10054, 'Connection reset by 
peer')>>> 
 
Can anybody help?


___Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor-- There's so many different worlds,So many different suns.And we have just one world,But we live in different ones.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] So close! But ... error: (10054, 'Connection reset by peer')

2006-07-16 Thread Grady Henry



I think that I am so close to getting this 
simple program to run correctly:
 
# Import smtplib for the actual sending 
functionimport smtplib
 
# Import the email modules we'll needfrom 
email.MIMEText import MIMEText
 
# Open a plain text file for reading.  For 
this example, assume that# the text file contains only ASCII 
characters.fp = open(r'C:\Documents and 
Settings\User\Desktop\\text3.txt')# Create a text/plain messagemsg = 
MIMEText(fp.read())fp.close()
 
# me == the sender's email address# you == the 
recipient's email addressmsg['Subject'] = 'The contents of %s' % 
'C:\Documents and Settings\User\Desktop\\text3.txt'msg['From'] = '[EMAIL PROTECTED]'msg['To'] = '[EMAIL PROTECTED]'
 
# Send the message via our own SMTP server, but 
don't include the# envelope header.s = 
smtplib.SMTP()s.set_debuglevel(1)s.connect(host='', 
port=25)__init__(self, host='', port=25, 
local_hostname=None)s.sendmail('[EMAIL PROTECTED]', ['[EMAIL PROTECTED]'], 
msg.as_string())s.quit()s.close()
 
But when I run it using IDLE, I get the 
following:
 
 
IDLE 1.1.3   No 
Subprocess >>> connect: ('', 25)connect: ('', 
25)Traceback (most recent call last):  File "C:\Documents and 
Settings\User\Desktop\textsender.py", line 24, in ?    
s.connect(host='', port=25)  File "C:\Python24\lib\smtplib.py", line 
307, in connect    (code, msg) = self.getreply()  
File "C:\Python24\lib\smtplib.py", line 348, in getreply    
line = self.file.readline()  File "C:\Python24\lib\socket.py", line 
340, in readline    data = 
"">error: (10054, 'Connection reset by 
peer')>>> 
 
Can anybody help?

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor