Skip to content

Instantly share code, notes, and snippets.

@BrandonLMorris
Last active January 1, 2016 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrandonLMorris/5720de3471eb44b3e2e6 to your computer and use it in GitHub Desktop.
Save BrandonLMorris/5720de3471eb44b3e2e6 to your computer and use it in GitHub Desktop.
#!/usr/bin python3
"""
A simple script to send a text message over gmail. Text messages are sent as
emails. The mail address depends on the carrier, based on the table below:
AT&T: number@txt.att.net
T-Mobile: number@tmomail.net
Verizon: number@vtext.com
Sprint: number@messaging.sprintpcs.com or number@pm.sprint.com
Virgin Mobile: number@vmobl.com
Tracfone: number@mmst5.tracfone.com
Password for the sending email is obtained in secret using getpass module
"""
import smtplib
from getpass import getpass
sender = # Your gmail address goes here
receiver = # The receiving number/email goes here
message = """Stay awesome, my friend"""
password = getpass('Enter the password for ' + sender + ': ')
# Ship it off
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.login(sender, password)
s.sendmail(sender, receiver, message)
s.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment