Skip to content

Instantly share code, notes, and snippets.

@surajnarwade
Created July 30, 2016 03:55
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 surajnarwade/d991780f5e42a4b2bea5f637b1ca5e2d to your computer and use it in GitHub Desktop.
Save surajnarwade/d991780f5e42a4b2bea5f637b1ca5e2d to your computer and use it in GitHub Desktop.
import smtplib
fromaddr = 'fromuser@gmail.com'
toaddrs = 'touser@gmail.com'
msg = 'There was a terrible error that occured and I wanted you to know!'
# Credentials (if needed)
username = 'fromuser'
password = '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