Last active
December 16, 2015 09:28
-
-
Save sedaghatfar/5413048 to your computer and use it in GitHub Desktop.
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" | |
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