Skip to content

Instantly share code, notes, and snippets.

@jslvtr
Created April 7, 2018 14:27
Show Gist options
  • Save jslvtr/3d4a5631c3d88cc510ab138264178ecc to your computer and use it in GitHub Desktop.
Save jslvtr/3d4a5631c3d88cc510ab138264178ecc to your computer and use it in GitHub Desktop.
Sending e-mails with Python
import smtplib
from email.message import EmailMessage
email = EmailMessage()
email['Subject'] = 'Test email'
email['From'] = '[email protected]'
email['To'] = '[email protected]'
email.set_content('Hello, John')
s = smtplib.SMTP(host='smtp.gmail.com', port=587)
s.starttls()
s.login('[email protected]', 'password')
s.send_message(email)
s.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment