From 381ecda1ce5fbbc9f8ed87aa39ab2f67b1f01782 Mon Sep 17 00:00:00 2001 From: jedi Date: Sat, 4 May 2024 01:36:46 +0200 Subject: [PATCH] stash --- core/mail/protocol.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/core/mail/protocol.py b/core/mail/protocol.py index 0bddfd0..d88d31a 100644 --- a/core/mail/protocol.py +++ b/core/mail/protocol.py @@ -197,13 +197,19 @@ def receive_email(envelope, log=None): header_in_reply_to = parsed.get('In-Reply-To') header_message_id = parsed.get('Message-ID') - # if header_from != envelope.mail_from: - # log.warning("Header from does not match envelope from") - # log.info(f"Header from: {header_from}, envelope from: {envelope.mail_from}") - # - # if header_to != envelope.rcpt_tos[0]: - # log.warning("Header to does not match envelope to") - # log.info(f"Header to: {header_to}, envelope to: {envelope.rcpt_tos[0]}") + if header_from != envelope.mail_from: + log.warning("Header from does not match envelope from") + log.info(f"Header from: {header_from}, envelope from: {envelope.mail_from}") + + if header_to != envelope.rcpt_tos[0]: + log.warning("Header to does not match envelope to") + log.info(f"Header to: {header_to}, envelope to: {envelope.rcpt_tos[0]}") + + # handle undelivered mail 'MAILER-DAEMON@' + + #if header_from.startswith('MAILER-DAEMON@'): + # log.warning("Mail delivery failed") + # return None, False, None, None if Email.objects.filter(reference=header_message_id).exists(): # break before issue thread is created log.warning("Email already exists")