mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 07:43:54 +08:00
not create html in send_email if html isn't set
This commit is contained in:
parent
80bbfb6f4b
commit
f8b6b20dd8
1 changed files with 7 additions and 7 deletions
|
@ -268,13 +268,13 @@ def send_email(
|
||||||
else:
|
else:
|
||||||
smtp = SMTP(POSTFIX_SERVER, POSTFIX_PORT or 25)
|
smtp = SMTP(POSTFIX_SERVER, POSTFIX_PORT or 25)
|
||||||
|
|
||||||
msg = MIMEMultipart("alternative")
|
if html:
|
||||||
msg.attach(MIMEText(plaintext))
|
msg = MIMEMultipart("alternative")
|
||||||
|
msg.attach(MIMEText(plaintext))
|
||||||
if not html:
|
msg.attach(MIMEText(html, "html"))
|
||||||
LOG.d("Use plaintext as html")
|
else:
|
||||||
html = plaintext.replace("\n", "<br>")
|
msg = Message()
|
||||||
msg.attach(MIMEText(html, "html"))
|
msg.set_payload(plaintext)
|
||||||
|
|
||||||
msg[headers.SUBJECT] = subject
|
msg[headers.SUBJECT] = subject
|
||||||
msg[headers.FROM] = f"{SUPPORT_NAME} <{SUPPORT_EMAIL}>"
|
msg[headers.FROM] = f"{SUPPORT_NAME} <{SUPPORT_EMAIL}>"
|
||||||
|
|
Loading…
Reference in a new issue