Skip to content

Instantly share code, notes, and snippets.

@AO8
Last active Jun 7, 2017
Embed
What would you like to do?
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