Created
April 6, 2021 20:25
-
-
Save M507/e990a777ac1b1afc88b2cad96ff7e6e1 to your computer and use it in GitHub Desktop.
Send_email.py
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_data(): | |
gmail_user = '[email protected]' | |
gmail_password = 'password' # env_var | |
# Create Email | |
mail_from = gmail_user | |
mail_to = "[email protected]" | |
mail_subject = 'You have a massage' | |
mail_message_body = 'Body \n' | |
mail_message = 'From: '+ gmail_user +'\nTo: ' + mail_to + '\nSubject: You have a new massage\n'+mail_message_body+'\n\n' | |
# Sent Email | |
server = smtplib.SMTP_SSL('smtp.gmail.com', 465) | |
server.login(gmail_user, gmail_password) | |
server.sendmail(mail_from, mail_to, mail_message) | |
server.close() | |
send_data() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment