diff --git a/email_handler.py b/email_handler.py
index 0ec1a620..b4a1b4ce 100644
--- a/email_handler.py
+++ b/email_handler.py
@@ -1392,6 +1392,13 @@ def handle_hotmail_complaint(msg: Message) -> bool:
orig_msg = get_orig_message_from_hotmail_complaint(msg)
to_header = orig_msg[headers.TO]
from_header = orig_msg[headers.FROM]
+
+ user = User.get_by(email=to_header)
+ if user:
+ LOG.d("Handle transactional hotmail complaint for %s", user)
+ handle_hotmail_complain_for_transactional_email(user)
+ return True
+
alias = None
# try parsing the from header which might contain the reverse alias
@@ -1445,6 +1452,22 @@ def handle_hotmail_complaint(msg: Message) -> bool:
return True
+def handle_hotmail_complain_for_transactional_email(user):
+ """Handle the case when a transactional email is set as Spam by user or by HotMail"""
+ send_email_with_rate_control(
+ user,
+ ALERT_HOTMAIL_COMPLAINT,
+ user.email,
+ f"Hotmail abuse report",
+ render("transactional/hotmail-transactional-complaint.txt.jinja2", user=user),
+ render("transactional/hotmail-transactional-complaint.html", user=user),
+ max_nb_alert=1,
+ nb_day=7,
+ )
+
+ return True
+
+
def handle_yahoo_complaint(msg: Message) -> bool:
"""
Handle yahoo complaint sent to postmaster
diff --git a/templates/emails/transactional/hotmail-transactional-complaint.html b/templates/emails/transactional/hotmail-transactional-complaint.html
new file mode 100644
index 00000000..98c9a5ed
--- /dev/null
+++ b/templates/emails/transactional/hotmail-transactional-complaint.html
@@ -0,0 +1,39 @@
+{% extends "base.html" %}
+
+{% block content %}
+ {% call text() %}
+ This is SimpleLogin team.
+ Hotmail has informed us about an email sent to {{ user.email }} that might have been considered as spam,
+ either by you or by Hotmail 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 Hotmail 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/hotmail-transactional-complaint.txt.jinja2 b/templates/emails/transactional/hotmail-transactional-complaint.txt.jinja2
new file mode 100644
index 00000000..dcb3bc59
--- /dev/null
+++ b/templates/emails/transactional/hotmail-transactional-complaint.txt.jinja2
@@ -0,0 +1,22 @@
+Hi,
+
+This is SimpleLogin team.
+
+Hotmail has informed us about an email sent to {{ user.email }} that might have been considered as spam,
+either by you or by Hotmail.
+
+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 Hotmail 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