Guest User

Untitled

a guest
Sep 11th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. import time
  2. import smtplib
  3. from email.mime.image import MIMEImage
  4. from email.mime.multipart import MIMEMultipart
  5. gmail_user = "covai.embedded@gmail.com"
  6. gmail_pwd = "*******"
  7. FROM = 'covai.embedded@gmail.com'
  8. TO = ['aaaaaaaaaaaaa@gmail.com']
  9. msg = MIMEMultipart()
  10. time.sleep(1)
  11. msg['Subject'] ='test message send from python'
  12. time.sleep(1)
  13. try:
  14. server = smtplib.SMTP("smtp.gmail.com", 587)
  15. print "smtp.gmail"
  16. server.ehlo()
  17. print "ehlo"
  18. server.starttls()
  19. print "starttls"
  20. server.login(gmail_user, gmail_pwd)
  21. print "reading mail & password"
  22. server.sendmail(FROM, TO, msg.as_string())
  23. print "from"
  24. server.close()
  25. print 'successfully sent the mail'
  26. except:
  27. print "failed to send mail"
Add Comment
Please, Sign In to add comment