create a notification when an alias is disabled

This commit is contained in:
Son 2022-03-09 17:59:02 +01:00
parent 0e3a5c3d3c
commit fb00c18d5a
2 changed files with 19 additions and 0 deletions

View File

@ -1403,6 +1403,15 @@ def handle_bounce_forward_phase(msg: Message, email_log: EmailLog):
alias.enabled = False
Session.commit()
Notification.create(
user_id=user.id,
title=f"{alias.email} has been disabled due to multiple bounces",
message=Notification.render(
"notification/alias-disable.html", alias=alias, mailbox=mailbox
),
commit=True,
)
send_email_with_rate_control(
user,
ALERT_BOUNCE_EMAIL,

View File

@ -0,0 +1,10 @@
<div>
There are several emails sent to your alias <b>{{ alias.email }}</b> that have been bounced by your
mailbox <b>{{ mailbox.email }}</b>.
</div>
<div>
As security measure, we have disabled the alias <b>{{ alias.email }}</b>.
</div>