Created
January 12, 2014 21:24
-
-
Save patrickfuller/8390767 to your computer and use it in GitHub Desktop.
Texting from your computer in Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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