On 1/23/25 12:53 AM, Danil Smirnov via Mailman-users wrote:

чт, 23 янв. 2025 г., 03:15 Mark Sapiro <m...@msapiro.net>:


You could try a patch like
```
--- a/src/mailman/runners/lmtp.py
+++ b/src/mailman/runners/lmtp.py
@@ -186,7 +186,8 @@ class LMTPHandler:
               listnames = set(getUtility(IListManager).names)
               # Parse the message data.  If there are any defects in the
               # message, reject it right away; it's probably spam.
-            msg = email.message_from_bytes(envelope.content, Message)
+            msg = email.message_from_bytes(envelope.content, Message,
+                policy=email.policy.Compat32(max_line_length=0))
               msg.set_unixfrom(envelope.mail_from)
           except Exception:
               elog.exception('LMTP message parsing')
```
This should prevent folding headers, but this is problematic. It may be
that the incoming message contains a folded header and this change will
not fold it in the outgoing message.


Doesn't this parameter fits better?

https://docs.python.org/3/library/email.policy.html#email.policy.EmailPolicy.refold_source

That would be better except Mailman uses the legacy email.message.Message class whose policy is Compat32 and the Compat32 policy doesn't accept refold_source.

--
Mark Sapiro <m...@msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan
_______________________________________________
Mailman-users mailing list -- mailman-users@mailman3.org
To unsubscribe send an email to mailman-users-le...@mailman3.org
https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
Archived at: 
https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/AMU2CTGVKAGOBJPV3ZHCRAB7TXRNQ3SB/

This message sent to arch...@mail-archive.com

Reply via email to