Advertisement
Guest User

Untitled

a guest
Jan 5th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #!/usr/bin/python
  2. import smtplib
  3. sender = 'email@mydomain.com'
  4. receivers = ['thisemail@yahoo.com']
  5.  
  6. message = """From: email <email@mydomain.com>
  7. To: Jac <mygmail@gmail.com>
  8. Subject: Test
  9. 222
  10. Yep in the inbox?
  11. """
  12. try:
  13. s = smtplib.SMTP('mail.mydomain.com')
  14. s.sendmail(sender, receivers, message)
  15. print "Successfully sent email"
  16. except smtplib.SMTPException:
  17. print "Error: unable to send email"
  18.  
  19. MAIL_SERVER = "mail.mydomain.com"
  20. MAIL_PORT = 25
  21. MAIL_USE_SSL = False
  22. MAIL_USE_TLS = True
  23. MAIL_USERNAME = os.environ["MAIL_USERNAME"]
  24. MAIL_PASSWORD = os.environ["MAIL_PASSWORD"]
  25. MAIL_DEBUG = True
  26. MAIL_DEFAULT_SENDER = '"Newsletter" <email@mydomain.com>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement