Advertisement
Guest User

Untitled

a guest
May 20th, 2019
293
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. subject = 'OMG Super Important Message'
  8. body = 'Hey, what"s up?\n\n- You'
  9.  
  10. email_text = """\
  11. From: %s
  12. To: %s
  13. Subject: %s
  14.  
  15. %s
  16. """ % (sent_from, ", ".join(to), subject, body)
  17.  
  18.  
  19. server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
  20. server.ehlo()
  21. server.login(gmail_user, gmail_password)
  22. server.sendmail(sent_from, to, email_text)
  23. server.close()
  24.  
  25. print 'Email sent!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement