Skip to content

Instantly share code, notes, and snippets.

@RyanRLong
Last active June 26, 2018 13:53
Show Gist options
  • Select an option

  • Save RyanRLong/44d393be131c1f1e750532642afcd8fb to your computer and use it in GitHub Desktop.

Select an option

Save RyanRLong/44d393be131c1f1e750532642afcd8fb to your computer and use it in GitHub Desktop.
Send Gmail with Python
import smtplib
USERNAME = '<username>'
PASSWORD = '<password>'
RECIPIENTS = [
'<email_address>',
'<email_address>',
]
smtp_server = smtplib.SMTP('smtp.gmail.com', 587)
smtp_server.ehlo()
smtp_server.starttls()
smtp_server.login(USERNAME, PASSWORD)
smtp_server.sendmail(USERNAME, RECIPIENTS , 'Subject: Happy Dingleberry Day!!\nHi Everyone! Happy Australia Day! Cheers, Julian')
smtp_server.quit()
print('Email sent successfully')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment