Bläddra i källkod

use website_email instead of website_from in bounce-email

Son NK 5 år sedan
förälder
incheckning
a081298756
2 ändrade filer med 5 tillägg och 7 borttagningar
  1. 4 6
      email_handler.py
  2. 1 1
      templates/emails/transactional/bounced-email.txt

+ 4 - 6
email_handler.py

@@ -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()

+ 1 - 1
templates/emails/transactional/bounced-email.txt

@@ -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: