Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import smtplib
- import sys
- gmail_user = ""
- gmail_password = ""
- email = ""
- ans = input("Provider? ")
- if ans == "att":
- email= "txt.att.net"
- if ans == "sprint":
- email= "messaging.sprintpcs.com"
- if ans == "tmobile":
- email= "tmomail.net"
- if ans == "verizon":
- email= "vtext.com"
- if ans == "virgin":
- email= "vmobl.com"
- if email == "":
- sys.exit("Error: Unrecognized provider.")
- ans = input("Number? ")
- if ans.isdigit():
- if len(ans) == 10:
- toaddr = [ans + "@" + email]
- else:
- sys.exit("Error: Invalid number (Length)")
- else:
- sys.exit("Error: Invalid number (NaN)")
- subject = input("Subject? ")
- msg = input("Message? ")
- fmsg = "\r\n".join([
- "From: " + gmail_user,
- "To:" + toaddr[0],
- "Subject: " + subject,
- "",
- msg
- ])
- server = smtplib.SMTP('smtp.gmail.com:587')
- server.ehlo()
- server.starttls()
- server.login(gmail_user,gmail_password)
- server.sendmail(gmail_user, toaddr, fmsg)
- server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement