Guest User

Untitled

a guest
Dec 10th, 2018
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import smtplib
  2. from email.mime.text import MIMEText
  3.  
  4. USERNAME = "username@gmail.com"
  5. PASSWORD = "password"
  6. MAILTO = "mailto@gmail.com"
  7.  
  8. msg = MIMEText('This is the body of the email')
  9. msg['Subject'] = 'The email subject'
  10. msg['From'] = USERNAME
  11. msg['To'] = MAILTO
  12.  
  13. server = smtplib.SMTP('smtp.gmail.com:587')
  14. server.ehlo_or_helo_if_needed()
  15. server.starttls()
  16. server.ehlo_or_helo_if_needed()
  17. server.login(USERNAME,PASSWORD)
  18. server.sendmail(USERNAME, MAILTO, msg.as_string())
  19. server.quit()
Add Comment
Please, Sign In to add comment