Skip to content

Instantly share code, notes, and snippets.

@patrickfuller
Created January 12, 2014 21:24
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 patrickfuller/8390767 to your computer and use it in GitHub Desktop.
Save patrickfuller/8390767 to your computer and use it in GitHub Desktop.
Texting from your computer in Python.
import smtplib
from email.mime.text import MIMEText
# Message to be sent
message = MIMEText("Hello, texting!")
# Sending email username/password and receiving phone number
email_username = ""
email_password = ""
phone_number = ""
# Gmail to Verizon. Change here for different combinations.
email_username += "@gmail.com"
phone_number += "@vtext.com"
# Format message to look like an email
message["From"] = email_username
message["To"] = phone_number
message["Subject"] = "From your server!"
# Connect and send
s = smtplib.SMTP('smtp.gmail.com:587')
s.starttls()
s.login(email_username, email_password)
s.sendmail(email_username, phone_number, message.as_string())
s.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment