From 897979d4cc6e1593bddbbb6762b75c89077f1adf Mon Sep 17 00:00:00 2001 From: Colin Goutte Date: Wed, 20 Oct 2021 12:26:02 +0200 Subject: [PATCH] Customize email --- papi/mail_sendermodel.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/papi/mail_sendermodel.py b/papi/mail_sendermodel.py index 594a077..7f92760 100644 --- a/papi/mail_sendermodel.py +++ b/papi/mail_sendermodel.py @@ -4,16 +4,16 @@ import os from papi.credentials import api_key, api_secret -def sendmail(htmlpart): +def sendmail(htmlpart, emails, textpart="", subject="Monitorig api"): mailjet = Client(auth=(api_key, api_secret), version="v3.1") data = { "Messages": [ { "From": {"Email": "colin.goutte@free.fr", "Name": "Colin"}, - "To": [{"Email": "colin.goutte@free.fr", "Name": "Colin"}], - "Subject": "Monitoring API", - "TextPart": "My first Mailjet email", + "To": [{"Email": email} for email in emails], + "Subject": "Monitoring API" + subject, + "TextPart": "" + textpart, "HTMLPart": "" + htmlpart, "CustomID": "AppGettingStartedTest", }