From 4ea6e676e49bae3b1224f8a7fbdf27759d52a344 Mon Sep 17 00:00:00 2001 From: Son NK Date: Wed, 3 Jul 2019 11:22:38 +0200 Subject: [PATCH] fill up plain_text_content when sending emails --- app/email_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/email_utils.py b/app/email_utils.py index df76ef6a..aa74a6e1 100644 --- a/app/email_utils.py +++ b/app/email_utils.py @@ -8,7 +8,7 @@ from app.config import SUPPORT_EMAIL, SENDGRID_API_KEY, ENV from app.log import LOG -def send(to_email, subject, html_content): +def send(to_email, subject, html_content, plain_content=None): # On local only print out email content if ENV == "local": LOG.d( @@ -16,11 +16,15 @@ def send(to_email, subject, html_content): ) return + if not plain_content: + plain_content = subject + message = Mail( from_email=SUPPORT_EMAIL, to_emails=to_email, subject=subject, html_content=html_content, + plain_text_content=plain_content, ) sg = SendGridAPIClient(SENDGRID_API_KEY) response = sg.send(message)