Skip to content

Instantly share code, notes, and snippets.

@sedaghatfar
Last active December 16, 2015 09:28
Show Gist options
  • Save sedaghatfar/5413048 to your computer and use it in GitHub Desktop.
Save sedaghatfar/5413048 to your computer and use it in GitHub Desktop.
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"
email_password = "password"
phone_number = "516#######"
# Gmail to sprint.
email_username += "@gmail.com"
phone_number += "@messaging.sprintpcs.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