From 5f6ad21e85c5a968d348265855a6814e28f61cba Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 28 Oct 2021 11:43:44 +0200 Subject: [PATCH] improve bounce email notification --- email_handler.py | 4 +++- .../transactional/bounce/bounced-email.html | 20 +++++++++---------- ...ced-email.txt => bounced-email.txt.jinja2} | 11 +++++----- 3 files changed, 18 insertions(+), 17 deletions(-) rename templates/emails/transactional/bounce/{bounced-email.txt => bounced-email.txt.jinja2} (55%) diff --git a/email_handler.py b/email_handler.py index 581aa854..583f1376 100644 --- a/email_handler.py +++ b/email_handler.py @@ -1297,16 +1297,18 @@ def handle_bounce_forward_phase(msg: Message, email_log: EmailLog): alias, ) disable_alias_link = f"{URL}/dashboard/unsubscribe/{alias.id}" + block_sender_link = f"{URL}/dashboard/alias_contact_manager/{alias.id}?highlight_contact_id={contact.id}" send_email_with_rate_control( user, ALERT_BOUNCE_EMAIL, user.email, f"Email from {contact.website_email} to {alias.email} cannot be delivered to your mailbox", render( - "transactional/bounce/bounced-email.txt", + "transactional/bounce/bounced-email.txt.jinja2", alias=alias, website_email=contact.website_email, disable_alias_link=disable_alias_link, + block_sender_link=block_sender_link, refused_email_url=refused_email_url, mailbox_email=mailbox.email, ), diff --git a/templates/emails/transactional/bounce/bounced-email.html b/templates/emails/transactional/bounce/bounced-email.html index f3924de4..dbfc573c 100644 --- a/templates/emails/transactional/bounce/bounced-email.html +++ b/templates/emails/transactional/bounce/bounced-email.html @@ -9,7 +9,7 @@ {% endcall %} {% call text() %} - This is usually because your mailbox service thinks the email is a spam. + This is usually because your mailbox service thinks the email is spam. {% endcall %} {{ render_button("View the bounced email", refused_email_url) }} @@ -20,21 +20,21 @@ Please consider the following options:
    -
  1. If the email is not spam at all, you can create a filter to explicitly allow this email - or simply all emails from SimpleLogin.
    - How to create the filter depends on your mailbox service. +
  2. If the email is not spam, you can create a + filter + to explicitly allow all emails from SimpleLogin.
  3. - If this email is indeed a spam, it means your alias {{alias.email}} is now in the hands of a spammer.
    - You should disable the alias immediately.
    - We'll automatically disable this alias when too many emails sent to it are bounced. + If this email is indeed spam, it means your alias {{ alias.email }} is now in the hands of a spammer. + You can either disable the alias + or block the sender if they send too many spams.
+ +
+ Please note that the alias can be automatically disabled if too many emails sent to it are bounced. {% endcall %} - {{ render_button("Disable alias", disable_alias_link) }} - {{ render_text('Thanks,
SimpleLogin Team.') }} - {{ raw_url(disable_alias_link) }} {% endblock %} diff --git a/templates/emails/transactional/bounce/bounced-email.txt b/templates/emails/transactional/bounce/bounced-email.txt.jinja2 similarity index 55% rename from templates/emails/transactional/bounce/bounced-email.txt rename to templates/emails/transactional/bounce/bounced-email.txt.jinja2 index b77dacc6..c77f1d1f 100644 --- a/templates/emails/transactional/bounce/bounced-email.txt +++ b/templates/emails/transactional/bounce/bounced-email.txt.jinja2 @@ -7,15 +7,14 @@ The email is automatically deleted in 7 days. Please consider the following options: -1. If the email is not spam at all, you can create a "filter" to explicitly allow this email - or simply all emails from SimpleLogin. - How to create the filter depends on your mailbox service. +1. If the email is not spam at all, you can create a "filter" to explicitly allow all emails from SimpleLogin. + We have a small gudie on https://simplelogin.io/docs/getting-started/troubleshooting/ 2. If this email is spam, it means your alias {{alias}} is now in the hands of a spammer. - You should disable or delete the alias immediately. - We'll automatically disable this alias the second time the email is refused. + You can either disable the alias on {{disable_alias_link}} + or block the sender on {{ block_sender_link }} if they send too many spams. -{{disable_alias_link}} +Please note that the alias can be automatically disabled if too many emails sent to it are bounced. Thanks, SimpleLogin team. \ No newline at end of file