diff --git a/email_handler.py b/email_handler.py index b4a1b4ce..afedd912 100644 --- a/email_handler.py +++ b/email_handler.py @@ -1479,6 +1479,12 @@ def handle_yahoo_complaint(msg: Message) -> bool: LOG.e("cannot find the alias") return False + user = User.get_by(email=to_header) + if user: + LOG.d("Handle transactional yahoo complaint for %s", user) + handle_yahoo_complain_for_transactional_email(user) + return True + _, alias_address = parse_full_address(get_header_unicode(to_header)) alias = Alias.get_by(email=alias_address) @@ -1508,6 +1514,22 @@ def handle_yahoo_complaint(msg: Message) -> bool: return True +def handle_yahoo_complain_for_transactional_email(user): + """Handle the case when a transactional email is set as Spam by user or by Yahoo""" + send_email_with_rate_control( + user, + ALERT_YAHOO_COMPLAINT, + user.email, + f"Yahoo abuse report", + render("transactional/yahoo-transactional-complaint.txt.jinja2", user=user), + render("transactional/yahoo-transactional-complaint.html", user=user), + max_nb_alert=1, + nb_day=7, + ) + + return True + + def handle_bounce_reply_phase(envelope, msg: Message, email_log: EmailLog): """ Handle reply phase bounce diff --git a/templates/emails/transactional/yahoo-transactional-complaint.html b/templates/emails/transactional/yahoo-transactional-complaint.html new file mode 100644 index 00000000..250d6b3a --- /dev/null +++ b/templates/emails/transactional/yahoo-transactional-complaint.html @@ -0,0 +1,42 @@ +{% extends "base.html" %} + +{% block content %} + {% call text() %} + This is SimpleLogin team. + {% endcall %} + + {% call text() %} + Yahoo has informed us about an email sent to {{ user.email }} that might have been considered as spam, + either by you or by Yahoo spam filter. + {% endcall %} + + {% call text() %} + Please note that explicitly marking a SimpleLogin's forwarded email as Spam + affects SimpleLogin email delivery, + has a negative effect for all users and is a violation of our terms and condition. + {% endcall %} + + {% call text() %} + If somehow Yahoo considers a forwarded email as Spam, it helps us if you can move the email + out of the Spam folder. You can also set up a filter to avoid this + from happening in the future using this guide at + https://simplelogin.io/docs/getting-started/troubleshooting/ + + {% endcall %} + + {% call text() %} + Please don't put our emails into the Spam folder. This can end up in your account being disabled on SimpleLogin. + {% endcall %} + + {% call text() %} + Looking to hear back from you. + {% endcall %} + + {% call text() %} + Best,
+ SimpleLogin Team. + {% endcall %} + +{% endblock %} + + diff --git a/templates/emails/transactional/yahoo-transactional-complaint.txt.jinja2 b/templates/emails/transactional/yahoo-transactional-complaint.txt.jinja2 new file mode 100644 index 00000000..d765f2ab --- /dev/null +++ b/templates/emails/transactional/yahoo-transactional-complaint.txt.jinja2 @@ -0,0 +1,22 @@ +Hi, + +This is SimpleLogin team. + +Yahoo has informed us about an email sent to {{ user.email }} that might have been considered as spam, +either by you or by Yahoo. + +Please note that explicitly marking a SimpleLogin's forwarded email as Spam + affects SimpleLogin email delivery, + has a negative effect for all users and is a violation of our terms and condition. + +If somehow Yahoo considers a forwarded email as Spam, it helps us if you can move the email + out of the Spam folder. You can also set up a filter to avoid this + from happening in the future using this guide at + https://simplelogin.io/docs/getting-started/troubleshooting/ + +Please don't put our emails into the Spam folder. This can end up in your account being disabled on SimpleLogin. + +Looking to hear back from you. + +Best, +SimpleLogin Team. \ No newline at end of file