Skip to content

Conversation

@RanKKI
Copy link
Contributor

@RanKKI RanKKI commented Jan 8, 2025

According to RFC 5322#3.6.4, both References and In-Reply-To are not unstructured fields and should have similar behaviour to Message-ID.

message-id      =   "Message-ID:" msg-id CRLF
in-reply-to     =   "In-Reply-To:" 1*msg-id CRLF
references      =   "References:" 1*msg-id CRLF

Sample Code

msg = textwrap.dedent(f"""\
            Message-ID: <long-but-perfectly-valid-message-id-that-does-not-end-up-qp-encoded@example.com>
            In-Reply-To: <reference-to-long-but-perfectly-valid-message-id-that-gets-qp-encoded@example.com>
            References: <reference-to-long-but-perfectly-valid-message-id-that-gets-qp-encoded@example.com> <reference-to-long-but-perfectly-valid-message-id-that-gets-qp-encoded@example.com>
            """)
msg = email.message_from_string(msg, policy=email.policy.default)

Before this patch

Message-ID: <long-but-perfectly-valid-message-id-that-does-not-end-up-qp-encoded@example.com>
In-Reply-To: =?utf-8?q?=3Creference-to-long-but-perfectly-valid-message-id-t?=
 =?utf-8?q?hat-gets-qp-encoded=40example=2Ecom=3E?=
References: =?utf-8?q?=3Creference-to-long-but-perfectly-valid-message-id-th?=
 =?utf-8?q?at-gets-qp-encoded=40example=2Ecom=3E_=3Creference-to-long-but-pe?=
 =?utf-8?q?rfectly-valid-message-id-that-gets-qp-encoded=40example=2Ecom=3E?=

After this patch

Message-ID: <long-but-perfectly-valid-message-id-that-does-not-end-up-qp-encoded@example.com>
In-Reply-To: <reference-to-long-but-perfectly-valid-message-id-that-gets-qp-encoded@example.com>
References: <reference-to-long-but-perfectly-valid-message-id-that-gets-qp-encoded@example.com>
 <reference-to-long-but-perfectly-valid-message-id-that-gets-qp-encoded@example.com>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants