Created
April 7, 2018 14:27
-
-
Save jslvtr/3d4a5631c3d88cc510ab138264178ecc to your computer and use it in GitHub Desktop.
Sending e-mails with Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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