Advertisement
Guest User

Untitled

a guest
May 20th, 2019
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import smtplib
  2.  
  3. gmail_user = 'user'
  4. gmail_password = 'password'
  5.  
  6. sent_from = gmail_user + '@gmail.com'
  7. to = ['me@gmail.com', 'bill@gmail.com', 'user@gmail.com']
  8. subject = 'OMG Super Important Message'
  9. body = 'Hey, what"s up?\n\n- You'
  10.  
  11. email_text = """\
  12. From: %s
  13. To: %s
  14. Subject: %s
  15.  
  16. %s
  17. """ % (sent_from, ", ".join(to), subject, body)
  18.  
  19.  
  20. server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
  21. server.ehlo()
  22. server.login(gmail_user, gmail_password)
  23. server.sendmail(sent_from, to, email_text)
  24. server.close()
  25.  
  26. print 'Email sent!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement