From 41555204d70e4185596f2c6e4a101c3e00702826 Mon Sep 17 00:00:00 2001 From: jedi Date: Sat, 4 May 2024 01:46:55 +0200 Subject: [PATCH] stash --- core/mail/protocol.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/mail/protocol.py b/core/mail/protocol.py index d5bb889..48b446f 100644 --- a/core/mail/protocol.py +++ b/core/mail/protocol.py @@ -211,7 +211,7 @@ def receive_email(envelope, log=None): # handle undelivered mail 'MAILER-DAEMON@' - if header_from.trim("<>").startswith('MAILER-DAEMON@') and envelope.mail_from.trim("<>") == "": + if header_from.strip("<>").startswith('MAILER-DAEMON@') and envelope.mail_from.strip("<>") == "": log.warning("Ignoring mailer daemon") raise SpecialMailException("Ignoring mailer daemon") @@ -298,6 +298,10 @@ class LMTPHandler: return '250 Message accepted for delivery' except SpecialMailException as e: + import uuid + random_filename = 'special-' + str(uuid.uuid4()) + with open(random_filename, 'wb') as f: + f.write(content) log.warning(f"Special mail exception: {e}") return '250 Message accepted for delivery' except Exception as e: