Skip to content

Instantly share code, notes, and snippets.

@clintmjohnson
Last active August 29, 2015 14:17
Show Gist options
  • Save clintmjohnson/54f1e52e035f19949348 to your computer and use it in GitHub Desktop.
Save clintmjohnson/54f1e52e035f19949348 to your computer and use it in GitHub Desktop.
This Python code sends a text email using Gmail account,
import smtplib
fromaddr = 'email@gmail.com'
toaddrs = 'email@gmail.com'
msg = 'There was a terrible error that occured and I wanted you to know!'
# Credentials (if needed)
username = 'email@gmail.com'
password = ''
# The actual mail send
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment