Commit 3dc0fd7f authored by Samy Haffoudhi's avatar Samy Haffoudhi

message a la bdd sheets

parent 02d2dedd
......@@ -6,16 +6,16 @@ from sheets import get_mails
EMAIL_ADDRESS = os.environ.get('EMAIL_USER')
EMAIL_PASSWORD = os.environ.get('EMAIL_PASS')
msg = EmailMessage()
msg['Subject'] = 'Test subject'
msg['From'] = EMAIL_ADDRESS
msg['To'] = 'haffoudhisamy@gmail.com'
msg.set_content('test content')
adresses = get_mails()
print(adresses)
adresses = get_mails()[1:]
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp:
smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
smtp.send_message(msg)
for adresse in adresses:
msg = EmailMessage()
msg['Subject'] = 'Message très important'
msg['From'] = EMAIL_ADDRESS
msg['To'] = adresse
msg.set_content('Bonjour Messieurs Fidèles, le nom de mon père.....')
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