Advertisement
Guest User

Untitled

a guest
Apr 11th, 2019
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #import smtp library
  2. import smtplib
  3.  
  4. #define connection parameters
  5. source = 'user1@gmail.com'
  6. dest = 'user2@gmail.com'
  7.  
  8.  
  9. #define message
  10. word = "\r\n".join([
  11. "source: user1@gmail.com",
  12. "To: user2@gmail.com",
  13. "Subject: Buenas dias",
  14. "",
  15. "Yo soy Pato"
  16. ])
  17.  
  18. #define the password for source
  19. passw = 'xxxxxxxx'
  20.  
  21. #set the smtp server
  22. server = smtplib.SMTP('smtp.gmail.com:587')
  23.  
  24. server.ehlo()
  25. server.starttls()
  26. server.login(source,passw)
  27. server.sendmail(source, dest, word)
  28. server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement