Guest User

Untitled

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