mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 23:16:00 +08:00
fill up plain_text_content when sending emails
This commit is contained in:
parent
8b3564c2f2
commit
4ea6e676e4
|
@ -8,7 +8,7 @@ from app.config import SUPPORT_EMAIL, SENDGRID_API_KEY, ENV
|
||||||
from app.log import LOG
|
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
|
# On local only print out email content
|
||||||
if ENV == "local":
|
if ENV == "local":
|
||||||
LOG.d(
|
LOG.d(
|
||||||
|
@ -16,11 +16,15 @@ def send(to_email, subject, html_content):
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not plain_content:
|
||||||
|
plain_content = subject
|
||||||
|
|
||||||
message = Mail(
|
message = Mail(
|
||||||
from_email=SUPPORT_EMAIL,
|
from_email=SUPPORT_EMAIL,
|
||||||
to_emails=to_email,
|
to_emails=to_email,
|
||||||
subject=subject,
|
subject=subject,
|
||||||
html_content=html_content,
|
html_content=html_content,
|
||||||
|
plain_text_content=plain_content,
|
||||||
)
|
)
|
||||||
sg = SendGridAPIClient(SENDGRID_API_KEY)
|
sg = SendGridAPIClient(SENDGRID_API_KEY)
|
||||||
response = sg.send(message)
|
response = sg.send(message)
|
||||||
|
|
Loading…
Reference in a new issue