From 754bd4964c0ff6db09e6f423f23d1d4e4debe117 Mon Sep 17 00:00:00 2001 From: Son Date: Tue, 5 Apr 2022 11:56:45 +0200 Subject: [PATCH] Set CONTENT_TRANSFER_ENCODING if absent --- email_handler.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/email_handler.py b/email_handler.py index e772406f..3286b9d8 100644 --- a/email_handler.py +++ b/email_handler.py @@ -2223,6 +2223,11 @@ def handle(envelope: Envelope, msg: Message) -> str: envelope.mail_from = mail_from envelope.rcpt_tos = rcpt_tos + # some emails don't have this header, set the default value (7bit) in this case + if headers.CONTENT_TRANSFER_ENCODING not in msg: + LOG.i("Set CONTENT_TRANSFER_ENCODING") + msg[headers.CONTENT_TRANSFER_ENCODING] = "7bit" + postfix_queue_id = get_queue_id(msg) if postfix_queue_id: set_message_id(postfix_queue_id)