-
-
Couldn't load subscription status.
- Fork 33.3k
Open
Labels
Description
Bug report
import email
import email.policy
msg = email.message.EmailMessage()
msg['Message-Id'] = '<long-but-perfectly-valid-message-id-that-does-not-end-up-qp-encoded@example.com>'
msg['References'] = '<reference-to-long-but-perfectly-valid-message-id-that-gets-qp-encoded@example.com>'
msg['In-Reply-To'] = '<reference-to-long-but-perfectly-valid-message-id-that-gets-qp-encoded@example.com>'
msg.set_payload('No body')
bdata = msg.as_bytes(policy=email.policy.SMTP)
print(bdata.decode())Expected output:
Message-Id: <long-but-perfectly-valid-message-id-that-does-not-end-up-qp-encoded@example.com>
References: <reference-to-long-but-perfectly-valid-message-id-that-gets-qp-encoded@example.com>
In-Reply-To: <reference-to-long-but-perfectly-valid-message-id-that-gets-qp-encoded@example.com>
No body
Actual output:
Message-Id: <long-but-perfectly-valid-message-id-that-does-not-end-up-qp-encoded@example.com>
References: =?utf-8?q?=3Creference-to-long-but-perfectly-valid-message-id-th?=
=?utf-8?q?at-gets-qp-encoded=40example=2Ecom=3E?=
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?=
No body
Your environment
- CPython versions tested on: 3.11.1
- Operating system and architecture: Fedora 37 x86_64