Skip to content

Instantly share code, notes, and snippets.

@AO8
Last active June 7, 2017 15:39
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 AO8/f064befd4647b61cc9c6bb3565ec6a0e to your computer and use it in GitHub Desktop.
Save AO8/f064befd4647b61cc9c6bb3565ec6a0e to your computer and use it in GitHub Desktop.
Send a text message from Gmail with Python
# allow less secure apps to access your Gmail at: https://support.google.com/accounts/answer/6010255?hl=en
# https://en.wikipedia.org/wiki/List_of_SMS_gateways
# ten_digit_number@mms.att.net for AT&T
# ten_digit_number@pm.sprint.com for Sprint
# ten_digit_number@tmomail.net for T-Mobile
# ten_digit_number@vzwpix.com for Verizon
import smtplib
username = "your_address@gmail.com"
password = "your_gmail_password"
to_addrs= "ten_digit_number@mms.att.net"
server = smtplib.SMTP("smtp.gmail.com:587")
server.starttls
server.login(username, password)
server.sendmail(username, to_addrs, "Enter your text message")
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment