Re: [Django] #35378: Incorrect folding of long address headers with special characters when using 7bit Content-Transfer-Encoding in EmailMessage (was: Bad UTF-8 "To" header encoding in EmailMessage)

5 views
Skip to first unread message

Django

unread,
Apr 17, 2024, 3:43:54 AM4/17/24
to django-...@googlegroups.com
#35378: Incorrect folding of long address headers with special characters when
using 7bit Content-Transfer-Encoding in EmailMessage
-----------------------------+------------------------------------
Reporter: andres | Owner: nobody
Type: Bug | Status: new
Component: Core (Mail) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by Sarah Boyce):

* cc: Florian Apolloner, Joachim Jablon (added)
* stage: Unreviewed => Accepted
* summary: Bad UTF-8 "To" header encoding in EmailMessage =>
Incorrect folding of long address headers with special characters when
using 7bit Content-Transfer-Encoding in EmailMessage
* version: 5.0 => dev

Comment:

Thank you for the report!
I can replicate and the discussion in https://github.com/anymail/django-
anymail/issues/369 is also very useful, thank you.

> I'm pretty sure the problem only occurs with Python email's legacy
`email.message.Message`, which uses a
[https://docs.python.org/3/library/email.policy.html#email.policy.Compat32.fold
different folding algorithm] (via `email.policy.compat32`) than modern
`email.message.EmailMessage` (`email.policy.default`) uses.
> My understanding is the Compat32 legacy layer is there specifically to
replicate Python 2's email behavior (including any bugs), so there's not
much point in reporting bugs against it.

Agree that #31784 is also somewhat related.
--
Ticket URL: <https://code.djangoproject.com/ticket/35378#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages