generate html from plaintext if not set

This commit is contained in:
Son NK 2020-06-10 12:18:39 +02:00
parent 0c4e48c906
commit b47d95226d

View file

@ -200,8 +200,10 @@ def send_email(to_email, subject, plaintext, html=None):
msg = MIMEMultipart("alternative")
msg.attach(MIMEText(plaintext, "text"))
if html:
msg.attach(MIMEText(html, "html"))
if not html:
html = plaintext.replace("\n", "<br>")
msg.attach(MIMEText(html, "html"))
msg["Subject"] = subject
msg["From"] = f"{SUPPORT_NAME} <{SUPPORT_EMAIL}>"