SMTP client.py

From PeformIQ Upgrade
Revision as of 13:58, 6 September 2008 by PeterHarding (talk | contribs) (New page: =SMTP CLient= <pre> #!/usr/bin/env python # #--------------------------------------------------------------------- import smtplib #------------------------------------------------------...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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()

#---------------------------------------------------------------------