Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import smtplib
- sender = 'from@fromdomain.com'
- receivers = ['to@todomain.com']
- message = """From: From Person <from@fromdomain.com>
- To: To Person <to@todomain.com>
- Subject: SMTP e-mail test
- This is a test e-mail message.
- """
- try:
- smtpObj = smtplib.SMTP('localhost')
- smtpObj.sendmail(sender, receivers, message)
- print "Successfully sent email"
- except SMTPException:
- print "Error: unable to send email"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement