Advertisement
Guest User

Untitled

a guest
Apr 27th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import smtplib
  4. import sys
  5.  
  6. gmail_user = ""
  7. gmail_password = ""
  8.  
  9. email = ""
  10. ans = input("Provider? ")
  11. if ans == "att":
  12. email= "txt.att.net"
  13. if ans == "sprint":
  14. email= "messaging.sprintpcs.com"
  15. if ans == "tmobile":
  16. email= "tmomail.net"
  17. if ans == "verizon":
  18. email= "vtext.com"
  19. if ans == "virgin":
  20. email= "vmobl.com"
  21. if email == "":
  22. sys.exit("Error: Unrecognized provider.")
  23.  
  24. ans = input("Number? ")
  25. if ans.isdigit():
  26. if len(ans) == 10:
  27. toaddr = [ans + "@" + email]
  28. else:
  29. sys.exit("Error: Invalid number (Length)")
  30. else:
  31. sys.exit("Error: Invalid number (NaN)")
  32.  
  33. subject = input("Subject? ")
  34. msg = input("Message? ")
  35.  
  36. fmsg = "\r\n".join([
  37. "From: " + gmail_user,
  38. "To:" + toaddr[0],
  39. "Subject: " + subject,
  40. "",
  41. msg
  42. ])
  43.  
  44. server = smtplib.SMTP('smtp.gmail.com:587')
  45. server.ehlo()
  46. server.starttls()
  47. server.login(gmail_user,gmail_password)
  48. server.sendmail(gmail_user, toaddr, fmsg)
  49. server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement