Skip to content

Instantly share code, notes, and snippets.

@fmartingr
Created August 4, 2014 09:31
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 fmartingr/9c510b77f17a33cd64c8 to your computer and use it in GitHub Desktop.
Save fmartingr/9c510b77f17a33cd64c8 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import smtplib
gmail_user = "your_email@gmail.com"
gmail_pwd = "your_password"
msg['From'] = gmail_user
msg['To'] = to
msg['Subject'] = subject
mailServer = smtplib.SMTP("smtp.gmail.com", 587)
mailServer.ehlo()
mailServer.starttls()
mailServer.ehlo()
mailServer.login(gmail_user, gmail_pwd)
mailServer.sendmail(gmail_user, to, "Test")
# Should be mailServer.quit(), but that crashes...
mailServer.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment