Commit db7ec09d authored by Samy Haffoudhi's avatar Samy Haffoudhi

lecture du mail depuis un fichier

parent 3dc0fd7f
...@@ -8,6 +8,9 @@ EMAIL_PASSWORD = os.environ.get('EMAIL_PASS') ...@@ -8,6 +8,9 @@ EMAIL_PASSWORD = os.environ.get('EMAIL_PASS')
adresses = get_mails()[1:] adresses = get_mails()[1:]
with open('contenu_mail', 'r') as fichier:
contenu = fichier.read()
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp: with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp:
smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD) smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
...@@ -15,7 +18,7 @@ with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp: ...@@ -15,7 +18,7 @@ with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp:
msg = EmailMessage() msg = EmailMessage()
msg['Subject'] = 'Message très important' msg['Subject'] = 'Message très important'
msg['From'] = EMAIL_ADDRESS msg['From'] = EMAIL_ADDRESS
msg.set_content(contenu)
msg['To'] = adresse msg['To'] = adresse
msg.set_content('Bonjour Messieurs Fidèles, le nom de mon père.....')
smtp.send_message(msg) smtp.send_message(msg)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment