Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import smtplib
  4.  
  5. sender = 'from@fromdomain.com'
  6. receivers = ['to@todomain.com']
  7.  
  8. message = """From: From Person <from@fromdomain.com>
  9. To: To Person <to@todomain.com>
  10. Subject: SMTP e-mail test
  11.  
  12. This is a test e-mail message.
  13. """
  14.  
  15. try:
  16.    smtpObj = smtplib.SMTP('localhost')
  17.    smtpObj.sendmail(sender, receivers, message)        
  18.    print "Successfully sent email"
  19. except SMTPException:
  20.    print "Error: unable to send email"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement