Created
September 23, 2020 15:00
-
-
Save zakirangwala/31144539bf45a7f237b427b42cdefa7a to your computer and use it in GitHub Desktop.
Tutorial code : Send emails
This file contains hidden or 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 | |
def send_mail(subject, body, reciever): | |
server = smtplib.SMTP('smtp.gmail.com', 587) | |
server.ehlo() | |
server.starttls() | |
server.ehlo() | |
server.login(config.email, config.password) | |
msg = f"Subject: {subject}\n\n{body}" | |
server.sendmail(config.email, reciever, msg) | |
server.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment