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(
"Bounce when sending to alias %s from %s, user %s",
alias,
contact.website_from,
contact.website_email,
alias.user,
)
@ -597,18 +597,17 @@ def handle_bounce(
LOG.d(
"Inform user %s about bounced email sent by %s to alias %s",
user,
contact.website_from,
contact.website_email,
address,
)
send_email(
# use user mail here as only user is authenticated to see the refused 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(
"transactional/bounced-email.txt",
name=user.name,
alias=alias,
website_from=contact.website_from,
website_email=contact.website_email,
disable_alias_link=disable_alias_link,
refused_email_url=refused_email_url,
@ -618,7 +617,6 @@ def handle_bounce(
"transactional/bounced-email.html",
name=user.name,
alias=alias,
website_from=contact.website_from,
website_email=contact.website_email,
disable_alias_link=disable_alias_link,
refused_email_url=refused_email_url,
@ -632,7 +630,7 @@ def handle_bounce(
LOG.d(
"Bounce happens again with alias %s from %s. Disable alias now ",
address,
contact.website_from,
contact.website_email,
)
alias.enabled = False
db.session.commit()

View File

@ -1,6 +1,6 @@
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.
You can view this email here: