Guest User

Untitled

a guest
Oct 17th, 2017
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. # smtp library that does it all for you!
  2. import smtplib as s
  3. from datetime import datetime, timedelta
  4.  
  5. smtpServer = ""
  6. # usually 25, 465, 587
  7. smtpPort = 465
  8.  
  9. username = ""
  10. password = ""
  11. numOfMessages = 20
  12. date = datetime.now() + timedelta(days=14)
  13. message = "offer expires {}".format(date)
  14. recipient = "test@email.com"
  15.  
  16. obj = s.SMTP(smtpServer, smtpPort)
  17. obj.ehlo()
  18. obj.starttls()
  19. obj.ehlo()
  20. obj.login(username, password)
  21. message = ("From: "+username+"\r\nTo: "+fullAddress+" \r\n\r\n "+message)
  22.  
  23. for x in range(numOfMessages):
  24. obj.sendmail(username, recipient, message)
Add Comment
Please, Sign In to add comment