Skip to content

Instantly share code, notes, and snippets.

@AO8
Last active June 7, 2017 15:39
Show Gist options
  • 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
# [email protected] for AT&T
# [email protected] for Sprint
# [email protected] for T-Mobile
# [email protected] for Verizon
import smtplib
username = "[email protected]"
password = "your_gmail_password"
to_addrs= "[email protected]"
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