Conversation
94171e2 to
4d2f02e
Compare
| email.message_from_string( | ||
| message.message().as_string() | ||
| ) |
There was a problem hiding this comment.
I might be misunderstanding what you wrote in your PR description, but won't this only work for Django 6+, while I believe you've left the repo set to continue supporting 5?
There was a problem hiding this comment.
Hi @coddingtonbear,
the main change in Django 6.0 is that message.message() now returns a <class 'email.message.EmailMessage'> instead of <class 'django.core.mail.message.SafeMIMEText'>.
But the new class, when serialized-deserialized as string, does not preserve custom headers like In-Reply-To.
I started with a Django 6 only fix, but it appeared that the serialization-deserialization wasn't useful (according to the test suite)
But I can definitely add a statement to apply it only for Django6+
Update CI to current django versions
Fix reply message parsing in Django 6 by avoiding legacy round‑trip
Root cause
Django 6 switched
EmailMessage.message()to return Python’s modernemail.message.EmailMessage. We were serializing that object to a string and re‑parsing it withemail.message_from_string(), which produces a legacy compat32 Message. That round‑trip dropped/failed to expose theIn-Reply-Toheader, so_process_messagenever setin_reply_to, causingtest_message_replyto fail.Fix
Skip the serialize/parse round‑trip and pass the
EmailMessageobject directly intorecord_outgoing_message. This preserves the In-Reply-To header and makes reply handling work consistently on Django 6+.NB: I dunno why this round‑trip was implemented in a first place, but all tests are passing now...