diff --git a/email_handler.py b/email_handler.py index a4a0a462..b205ad80 100644 --- a/email_handler.py +++ b/email_handler.py @@ -550,6 +550,18 @@ def handle_email_sent_to_ourself(alias, from_addr: str, msg: Message, user): # link available for 6 days as it gets deleted in 7 days refused_email_url = refused_email.get_url(expires_in=518400) + Notification.create( + user_id=user.id, + title=f"Email sent to {alias.email} from its own mailbox {from_addr}", + message=Notification.render( + "notification/cycle-email.html", + alias=alias, + from_addr=from_addr, + refused_email_url=refused_email_url, + ), + commit=True, + ) + send_email_at_most_times( user, ALERT_SEND_EMAIL_CYCLE, diff --git a/templates/dashboard/notification.html b/templates/dashboard/notification.html index 2eb6ccb2..04ac1ec1 100644 --- a/templates/dashboard/notification.html +++ b/templates/dashboard/notification.html @@ -18,9 +18,8 @@ {{ notification.message | safe }} -
- -
+
diff --git a/templates/notification/cycle-email.html b/templates/notification/cycle-email.html new file mode 100644 index 00000000..2fb6ea84 --- /dev/null +++ b/templates/notification/cycle-email.html @@ -0,0 +1,10 @@ +
+ An email was sent to your alias {{ alias.email }} from its own mailbox {{ from_addr }}. +
+
+ SimpleLogin doesn't send this email back to your mailbox as it would be refused or hidden anyway by your email + service. +
+
+ So no worries, there's nothing you need to do :). +
\ No newline at end of file