Skip to content

Instantly share code, notes, and snippets.

@AO8
Last active October 1, 2017 22:53
Show Gist options
  • Save AO8/f7b7120a7d5bef5387961cac3069fa9c to your computer and use it in GitHub Desktop.
Save AO8/f7b7120a7d5bef5387961cac3069fa9c to your computer and use it in GitHub Desktop.
Send Gmail with Python
# Allow less secure apps to access your gmail account
import email
import smtplib
fromaddr = "[email protected]"
toaddr = "[email protected]"
msg = "Content of your email message."
username = "yourGmailAddress"
password = "yourPassword"
server = smtplib.SMTP("smtp.gmail.com:587")
server.starttls()
server.login(username, password)
server.sendmail(fromaddr, toaddr, msg)
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment