Skip to content

Instantly share code, notes, and snippets.

@rmax
Created February 11, 2010 01:16
Show Gist options
  • Select an option

  • Save rmax/301083 to your computer and use it in GitHub Desktop.

Select an option

Save rmax/301083 to your computer and use it in GitHub Desktop.
import smtplib
gmail_account = 'darkrho@gmail.com'
gmail_pass = 'misuperpass'
to_emails = ['darkrho@gmail.com']
message = """From: %s
To: %s
Subject: python rulz!
Hola :P
""" % (gmail_account, ', '.join(to_emails))
server = smtplib.SMTP('smtp.gmail.com', 587)
server.set_debuglevel(1)
server.ehlo()
server.starttls()
server.login(gmail_account, gmail_pass)
server.sendmail(gmail_account, to_emails, message)
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment