#36119: Attaching email file to email fails if the attachment is using 8bit
Content-Transfer-Encoding
-----------------------------+------------------------------------
Reporter: Trenton H | Owner: (none)
Type: Bug | Status: new
Component: Core (Mail) | Version: 5.1
Severity: Normal | Resolution:
Keywords: compat32 | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Comment (by Mike Edmunds):
#35581 is stalled waiting for some Python core library fixes, so won't get
merged before Django 6.0 at the earliest. I think it's worth fixing this
bug before then.
Maybe start by adding a new, failing test case in
django/tests/mail/tests.py. (That's a long file, and not particularly well
organized, but most of the attachment-related tests are kind of grouped
together in the middle, so maybe somewhere near them.) You could probably
even use the minimal example from my earlier comment. (Or make it even
more minimal: neither `to` nor `Subject` are relevant to the bug.)
Once that test fails, I'm pretty sure you can fix it in
django/core/mail/message.py by changing
`message_from_string(force_str(content))` to
`message_from_bytes(force_bytes(content))` (and fixing up the imports).
And then running all the tests to see if that breaks anything else. (I
wouldn't expect it to, but I'm often wrong, so it's good we have tests.)
--
Ticket URL: <https://code.djangoproject.com/ticket/36119#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701948abdf01a-4a23b47b-d84e-407f-9ec6-69991e503164-000000%40eu-central-1.amazonses.com.