SMTP with Python 1.6

ColBoy programmedintegration at home.com
Mon Jun 26 08:21:56 EDT 2000


I'm just learning the basics of Python having been a programmer for over 10
years.  I'm having  alittle difficulty with the following code.

#!c:\python\python.exe

import cgi, smtplib
s=smtplib.SMTP("localhost")
print "Content-Type: text\plain\n\n"
tolist=["colinmeeks at yahoo.com"]
The_Form=cgi.FieldStorage()
message=''
for name in The_Form.keys():
    message=message+"<B>Input:</B> "+name+" <B>Value:</B>
"+The_Form[name].value+"<BR>"
print message;
s.sendmail("colboy at programmedintegration.com", tolist, message)
print "Finished!"
s.quit;

If I comment out the SMTP specific things it works fine, printing out names
and values from a submitted webpage.  If I uncomment the SMTP stuff, nothing
appears and no email gets sent, also no error is shown.  Could someone give
me a pointer to what I'm doing wrong.

Colin





More information about the Python-list mailing list