[Tutor] error: (10054, 'Connection reset by peer')

2006-07-09 Thread Grady Henry



Here is a program that I wrote using the first 
example at 12.2.13 Examples at the www.python.org website,
 
# 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('C:\Documents and 
Settings\User\Desktop\\text3.txt','rb')# 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.connect()s.sendmail(me, [you], 
msg.as_string())s.close()
 
When I run the program using IDLE, I get the 
following message:
 
Traceback (most recent call last):  File 
"C:\Documents and Settings\User\Desktop\textsender.py", line 23, in 
?    s.connect()  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')
 
What does this mean, and how can I fix 
it?
 
Grady Henry
[EMAIL PROTECTED]
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] How do I get my machine to run an SMTP server?

2006-07-11 Thread Grady Henry
rint this message and 
exit.
 
    -d directory    
--directory=directory    Mail the 
contents of the specified directory, otherwise use 
the    current directory.  Only 
the regular files in the directory are 
sent,    and we don't recurse to 
subdirectories.
 
`from' is the email address of the sender of the message.
 
`to' is the email address of the recipient of the message, and 
multiplerecipients may be given.
 
The email is sent by forwarding to your local SMTP server, which then does 
thenormal delivery process.  Your local machine must be running an SMTP 
server.
 
Traceback (most recent call last):  File "C:\Documents and 
Settings\User\Desktop\EB2.py", line 125, in ?    
main()  File "C:\Documents and Settings\User\Desktop\EB2.py", line 65, 
in main    usage(1)  File "C:\Documents and 
Settings\User\Desktop\EB2.py", line 48, in usage    
sys.exit(code)SystemExit: 1
 
I guess that my first question is how do I get my machine to run an 
SMTP server?
 
Also, I'd like to say that I greatly appreciate all of the help 
that I've gotten in the past.
 
Grady Henry
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python Programming Books

2006-07-13 Thread Grady Henry
I have three books on Python programming, "Learning Python" by O'Reilly, 
"Beginning Python" by Hetland, and "Python in a Nutshell" by O'Reilly.  Are 
these good (recommended) books?  Any others that might be recommended? 


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


[Tutor] error: (10054, 'Connection reset by peer')

2006-07-15 Thread Grady Henry



Here is a program that I wrote using one of 
the python.org's examples at 12.2.13 (first example 
listed):
 
# 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.connect()__init__(self, host='', port=0, 
local_hostname=None)s.sendmail('[EMAIL PROTECTED]', ['[EMAIL PROTECTED]'], 
msg.as_string())s.close()
 
And this is what I get when I run the 
program using IDLE:
 
Traceback (most recent call last):  File 
"C:\Documents and Settings\User\Desktop\textsender.py", line 23, in 
?    s.connect()  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')
 
Anybody have any 
suggestions?
 
Grady Henry
___
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


[Tutor] This will run on Outlook but not Outlook Express

2006-08-05 Thread Grady Henry



The following script will run on Microsoft Outlook 
but not on Outlook Express:
 
from win32com.client import 
Dispatchs=Dispatch("Mapi.Session")s.Logon()newMsg = 
s.Outbox.Messages.Add("Hi from Python", "Hello")recip = 
newMsg.Recipients.Add("Greg Hart", 
"SMTP:[EMAIL PROTECTED]")newMsg.Send()s.DeliverNow()
 
I was wondering if I could write a script that 
would run on both Outlook and Outlook Express.
 
Can anybody help?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor