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 "
<a href="http://smtp.cox.net">smtp.cox.net</a>").<br> -Arcege<br><br><div><span class="gmail_quote">On 7/16/06, <b class="gmail_sendername">Grady Henry</b> <<a href="mailto:gwhjr@cox.net">gwhjr@cox.net</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
<div bgcolor="#ffffff">
<div><font face="Arial" size="2"><strong>I think that I am so close to getting this
simple program to run correctly:</strong></font></div>
<div><strong><font face="Arial" size="2"></font></strong> </div>
<div><font face="Arial" size="2"># Import smtplib for the actual sending
function<br>import smtplib</font></div>
<div> </div>
<div><font face="Arial" size="2"># Import the email modules we'll need<br>from
email.MIMEText import MIMEText</font></div>
<div> </div>
<div><font face="Arial" size="2"># Open a plain text file for reading. For
this example, assume that<br># the text file contains only ASCII
characters.<br>fp = open(r'C:\Documents and
Settings\User\Desktop\\text3.txt')<br># Create a text/plain message<br>msg =
MIMEText(fp.read())<br>fp.close()</font></div>
<div> </div>
<div><font face="Arial" size="2"># me == the sender's email address<br># you == the
recipient's email address<br>msg['Subject'] = 'The contents of %s' %
'C:\Documents and Settings\User\Desktop\\text3.txt'<br>msg['From'] = <a href="mailto:%27gwhjr@cox.net%27" title="mailto:'gwhjr@cox.net'" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">'gwhjr@cox.net'
</a><br>msg['To'] = <a href="mailto:%27gwhjr@bigfoot.com%27" title="mailto:'gwhjr@bigfoot.com'" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">'gwhjr@bigfoot.com'</a></font></div>
<div> </div>
<div><font face="Arial" size="2"># Send the message via our own SMTP server, but
don't include the<br># envelope header.<br>s =
smtplib.SMTP()<br>s.set_debuglevel(1)<br>s.connect(host='',
port=25)<br>__init__(self, host='', port=25,
local_hostname=None)<br>s.sendmail(<a href="mailto:%27gwhjr@cox.net%27" title="mailto:'gwhjr@cox.net'" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">'gwhjr@cox.net'</a>, ['<a href="mailto:gwhjr@bigfoot.com" title="mailto:gwhjr@bigfoot.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
gwhjr@bigfoot.com</a>'],
msg.as_string())<br>s.quit()<br>s.close()</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><strong><font face="Arial" size="2">But when I run it using IDLE, I get the
following:</font></strong></div>
<div><strong><font face="Arial" size="2"></font></strong> </div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">IDLE 1.1.3 ==== No
Subprocess ====<br>>>> <br>connect: ('', 25)<br>connect: ('',
25)<br>Traceback (most recent call last):<br> File "C:\Documents and
Settings\User\Desktop\textsender.py", line 24, in ?<br>
s.connect(host='', port=25)<br> File "C:\Python24\lib\smtplib.py", line
307, in connect<br> (code, msg) = self.getreply()<br>
File "C:\Python24\lib\smtplib.py", line 348, in getreply<br>
line = self.file.readline()<br> File "C:\Python24\lib\socket.py", line
340, in readline<br> data =
self._sock.recv(self._rbufsize)<br>error: (10054, 'Connection reset by
peer')<br>>>> </font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"><strong>Can anybody help?</strong></font></div>
<div><br></div></div>
</div><br>_______________________________________________<br>Tutor maillist - <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Tutor@python.org">Tutor@python.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">
http://mail.python.org/mailman/listinfo/tutor</a><br><br><br></blockquote></div><br><br clear="all"><br>-- <br>There's so many different worlds,<br>So many different suns.<br>And we have just one world,<br>But we live in different ones.