From 33163660f7ef9900b8faccff32f51be8cf6f65a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Casaj=C3=BAs?= Date: Mon, 21 Feb 2022 12:30:26 +0100 Subject: [PATCH] PR comments --- app/email_utils.py | 3 +-- email_handler.py | 7 +++---- templates/emails/transactional/unsubscribe-newsletter.txt | 2 -- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/email_utils.py b/app/email_utils.py index e176eddb..69957e40 100644 --- a/app/email_utils.py +++ b/app/email_utils.py @@ -38,7 +38,6 @@ from app.config import ( DKIM_SELECTOR, DKIM_PRIVATE_KEY, ALIAS_DOMAINS, - SUPPORT_NAME, POSTFIX_SUBMISSION_TLS, MAX_NB_EMAIL_FREE_PLAN, MAX_ALERT_24H, @@ -296,7 +295,7 @@ def send_email( msg[headers.CONTENT_TYPE] = "text/plain" msg[headers.SUBJECT] = subject - msg[headers.FROM] = f"{SUPPORT_NAME} <{NOREPLY}>" + msg[headers.FROM] = f"{NOREPLY} <{NOREPLY}>" msg[headers.TO] = to_email msg_id_header = make_msgid() diff --git a/email_handler.py b/email_handler.py index 744572fb..c5110d2b 100644 --- a/email_handler.py +++ b/email_handler.py @@ -2081,14 +2081,13 @@ def should_ignore(mail_from: str, rcpt_tos: List[str]) -> bool: def send_no_reply_response(mail_from: str, msg: Message): mailbox = Mailbox.get_by(email=mail_from) - user = User.get(mailbox.user_id) - if not user: + if not mailbox: LOG.d("Unknown sender. Skipping reply from {}".format(NOREPLY)) return send_email_at_most_times( - user, + mailbox.user, ALERT_TO_NOREPLY, - user.email, + mailbox.user.email, "Auto: {}".format(msg[headers.SUBJECT] or "No subject"), render("transactional/noreply.text.jinja2"), ) diff --git a/templates/emails/transactional/unsubscribe-newsletter.txt b/templates/emails/transactional/unsubscribe-newsletter.txt index eb78d5c4..e6f2d11f 100644 --- a/templates/emails/transactional/unsubscribe-newsletter.txt +++ b/templates/emails/transactional/unsubscribe-newsletter.txt @@ -2,6 +2,4 @@ {% block content %} You have been unsubscribed from SimpleLogin newsletter. - -We would love to know why do you want to unsubscribe from our communication. {% endblock %}