use website_email instead of website_from in bounce-email

This commit is contained in:
Son NK 2020-04-05 11:59:24 +02:00
parent b2f22db9f6
commit a081298756
2 changed files with 5 additions and 7 deletions

View file

@ -445,7 +445,7 @@ def handle_reply(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, str
LOG.warning( LOG.warning(
"Bounce when sending to alias %s from %s, user %s", "Bounce when sending to alias %s from %s, user %s",
alias, alias,
contact.website_from, contact.website_email,
alias.user, alias.user,
) )
@ -597,18 +597,17 @@ def handle_bounce(
LOG.d( LOG.d(
"Inform user %s about bounced email sent by %s to alias %s", "Inform user %s about bounced email sent by %s to alias %s",
user, user,
contact.website_from, contact.website_email,
address, address,
) )
send_email( send_email(
# use user mail here as only user is authenticated to see the refused email # use user mail here as only user is authenticated to see the refused email
user.email, user.email,
f"Email from {contact.website_from} to {address} cannot be delivered to your inbox", f"Email from {contact.website_email} to {address} cannot be delivered to your inbox",
render( render(
"transactional/bounced-email.txt", "transactional/bounced-email.txt",
name=user.name, name=user.name,
alias=alias, alias=alias,
website_from=contact.website_from,
website_email=contact.website_email, website_email=contact.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,
@ -618,7 +617,6 @@ def handle_bounce(
"transactional/bounced-email.html", "transactional/bounced-email.html",
name=user.name, name=user.name,
alias=alias, alias=alias,
website_from=contact.website_from,
website_email=contact.website_email, website_email=contact.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,
@ -632,7 +630,7 @@ def handle_bounce(
LOG.d( LOG.d(
"Bounce happens again with alias %s from %s. Disable alias now ", "Bounce happens again with alias %s from %s. Disable alias now ",
address, address,
contact.website_from, contact.website_email,
) )
alias.enabled = False alias.enabled = False
db.session.commit() db.session.commit()

View file

@ -1,6 +1,6 @@
Hi {{name}} Hi {{name}}
An email sent to your alias {{alias.email}} from {{website_from}} was refused (or bounced) by your mailbox {{mailbox_email}}. An email sent to your alias {{alias.email}} from {{website_email}} was refused (or bounced) by your mailbox {{mailbox_email}}.
This is usually due to the email being considered as spam by your email provider. This is usually due to the email being considered as spam by your email provider.
You can view this email here: You can view this email here: