Guest User

Untitled

a guest
Apr 26th, 2019
55
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. import MIMEMultipart
  4. from email.mime.image import MIMEImage
  5. #from email.mime.multipart import MIMEMultipart
  6. gmail_user = 'covai.embedded@gmail.com'
  7. password='.....'
  8. FROM = 'covai.embedded@gmail.com'
  9. TO = ['covai.embedded@gmail.com']
  10. msg['Subject']='Testing message'
  11. time.sleep(1)
  12. msg = MIMEMultipart()
  13. time.sleep(1)
  14. try:
  15. server = smtplib.SMTP("smtp.gmail.com", 587) #or port 465 doesn't seem to work!
  16. print "smtp.gmail"
  17. server.ehlo()
  18. print "ehlo"
  19. server.starttls()
  20. print "starttls"
  21. server.login(gmail_user, password)
  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