Improve emails that inform unauthorized user

This commit is contained in:
Son NK 2020-02-11 22:58:30 +07:00
parent b41a61165c
commit 7598a167d0
3 changed files with 20 additions and 3 deletions

View File

@ -186,7 +186,7 @@ def send_email(to_email, subject, plaintext, html):
msg["To"] = to_email
msg.set_content(plaintext)
if html is not None:
if html:
msg.add_alternative(html, subtype="html")
msg_id_header = make_msgid()

View File

@ -348,10 +348,15 @@ class MailHandler:
),
)
# Notify sender that they cannot send emails to this address
send_email(
envelope.mail_from,
f"Your email ({envelope.mail_from}) is not allowed to send email to {reply_email}",
"",
f"Your email ({envelope.mail_from}) is not allowed to send emails to {reply_email}",
render(
"transactional/send-from-alias-from-unknown-sender.txt",
sender=envelope.mail_from,
reply_email=reply_email,
),
"",
)

View File

@ -0,0 +1,12 @@
Hi,
This is an automated email from SimpleLogin.
We have recorded an attempt to send an email from your email ({{sender}}) to {{reply_email}}.
{{reply_email}} is a special email address that only receive emails from its authorized user.
If you have any question, you can contact us by replying to this email or consult our website at https://simplelogin.io.
Regards,
SimpleLogin team.