Send refused email notif to user email instead of mailbox

This commit is contained in:
Son NK 2020-03-15 12:15:11 +01:00
parent 45d560fd70
commit 9cdf766825

View file

@ -572,7 +572,8 @@ def handle_bounce(
alias, alias,
) )
send_email( send_email(
mailbox_email, # use user mail here as only user is authenticated to see the refused email
user.email,
f"Email from {forward_email.website_from} to {alias} cannot be delivered to your inbox", f"Email from {forward_email.website_from} to {alias} cannot be delivered to your inbox",
render( render(
"transactional/bounced-email.txt", "transactional/bounced-email.txt",
@ -582,6 +583,7 @@ def handle_bounce(
website_email=forward_email.website_email, website_email=forward_email.website_email,
disable_alias_link=disable_alias_link, disable_alias_link=disable_alias_link,
refused_email_url=refused_email_url, refused_email_url=refused_email_url,
mailbox_email=mailbox_email
), ),
render( render(
"transactional/bounced-email.html", "transactional/bounced-email.html",
@ -591,6 +593,7 @@ def handle_bounce(
website_email=forward_email.website_email, website_email=forward_email.website_email,
disable_alias_link=disable_alias_link, disable_alias_link=disable_alias_link,
refused_email_url=refused_email_url, refused_email_url=refused_email_url,
mailbox_email=mailbox_email
), ),
# cannot include bounce email as it can contain spammy text # cannot include bounce email as it can contain spammy text
# bounced_email=msg, # bounced_email=msg,
@ -606,7 +609,8 @@ def handle_bounce(
db.session.commit() db.session.commit()
send_email( send_email(
mailbox_email, # use user mail here as only user is authenticated to see the refused email
user.email,
f"Alias {alias} has been disabled due to second undelivered email from {forward_email.website_from}", f"Alias {alias} has been disabled due to second undelivered email from {forward_email.website_from}",
render( render(
"transactional/automatic-disable-alias.txt", "transactional/automatic-disable-alias.txt",
@ -615,6 +619,7 @@ def handle_bounce(
website_from=forward_email.website_from, website_from=forward_email.website_from,
website_email=forward_email.website_email, website_email=forward_email.website_email,
refused_email_url=refused_email_url, refused_email_url=refused_email_url,
mailbox_email=mailbox_email
), ),
render( render(
"transactional/automatic-disable-alias.html", "transactional/automatic-disable-alias.html",
@ -623,6 +628,7 @@ def handle_bounce(
website_from=forward_email.website_from, website_from=forward_email.website_from,
website_email=forward_email.website_email, website_email=forward_email.website_email,
refused_email_url=refused_email_url, refused_email_url=refused_email_url,
mailbox_email=mailbox_email
), ),
# cannot include bounce email as it can contain spammy text # cannot include bounce email as it can contain spammy text
# bounced_email=msg, # bounced_email=msg,