Created
May 27, 2020 20:50
-
-
Save kavehbc/89b937d0825b5335ae07c35472c4d9b1 to your computer and use it in GitHub Desktop.
Python - Sending email via yagmail
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 yagmail | |
def sendGMail(email): | |
user = 'your_username@gmail.com' | |
app_password = 'your_app_password' | |
to = email | |
subject = 'test subject 1' | |
content = ['mail body content'] | |
with yagmail.SMTP(user, app_password) as yag: | |
yag.send(to, subject, content) | |
print('Sent email successfully') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment