Difference between revisions of "SMTP client.py"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) m (Smtp client.py moved to SMTP client.py: Typo conventions) |
PeterHarding (talk | contribs) |
||
Line 41: | Line 41: | ||
[[Category:Python]] | [[Category:Python]] | ||
[[Category:SMTP]] | [[Category:SMTP]] | ||
[[Category:Examples]] |
Latest revision as of 17:14, 19 July 2009
SMTP CLient
#!/usr/bin/env python # #--------------------------------------------------------------------- import smtplib #--------------------------------------------------------------------- debugLvl = 2 #host = "localhost" host = "mail.xxx.net.au" fromaddr = xxx@xxx.com.au" toaddr = "xxx.xxx@xxx.com.au" MSG = """\ From: %s To: %s Subject: Subject This is a new message """ #--------------------------------------------------------------------- msg = MSG % (fromaddr, toaddr) print "Message length is %d" % len(msg) server = smtplib.SMTP(host) server.set_debuglevel(debugLvl) server.sendmail(fromaddr, toaddr, msg) server.quit() #---------------------------------------------------------------------