Repository navigation
Missing 'linear-white-space' between encoded-word in RFC2047 header #144156
Copy link
Copy link
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jan 22, 2026 - addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Jan 22, 2026 This issue is impacting the delivery of emailS to Yahoo. Yahoo has a strict policy regarding RFC2047 encoding and is rejecting the emails that are tripping on this issue. It doesn't seem we can do much about to mitigate this problem, beside disabling folding.
Reacted by Guewen BaconnierChecked more versions, based on this script
#!/usr/bin/env python3 import email.policy import sys from email.message import EmailMessage message = EmailMessage(policy=email.policy.SMTP) subject = "Re: [SOS-1495488] Commande et livraison - Demande de retour - bibijolie - 251210-AABBCC - Abo actualités digitales 20 semaines d’abonnement à 24 heures, Bilan, Tribune de Genève et tous les titres Tamedia" message["Subject"] = subject if b"?==?" in message.as_bytes(): print(f"Python {sys.version}: ❌") else: print(f"Python {sys.version}: ✅")
Result
❯ for version in 3.7.17 3.8.20 3.9.25 3.10.19 3.11.14 3.12.12 3.13.11 3.14.2 3.15-dev; do mise exec python@$version -- python /tmp/check_email.py; done Python 3.7.17 (default, Feb 3 2026, 15:19:23) [GCC 15.2.1 20260103]: ✅ Python 3.8.20 (default, Oct 2 2024, 16:34:12) [Clang 18.1.8 ]: ✅ Python 3.9.25 (main, Oct 31 2025, 23:00:23) [Clang 21.1.4 ]: ✅ Python 3.10.19 (main, Jan 27 2026, 23:59:05) [Clang 21.1.4 ]: ✅ Python 3.11.14 (main, Jan 27 2026, 23:58:49) [Clang 21.1.4 ]: ✅ Python 3.12.12 (main, Jan 27 2026, 23:58:14) [Clang 21.1.4 ]: ❌ Python 3.13.11 (main, Jan 28 2026, 00:01:45) [Clang 21.1.4 ]: ❌ Python 3.14.2 (main, Dec 17 2025, 21:08:09) [Clang 21.1.4 ]: ❌ Python 3.15.0a5+ (heads/main:6181b69, Jan 22 2026, 09:30:43) [GCC 15.2.1 20260103]: ❌
I think this might be the PR that introduced the change in behavior gh-92281
Thanks all, the fix is now merged and backported.
Reacted by Guewen Baconnier
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Bug report
Bug description:
result
When sending an email with this subject, yahoo rejects it with a soft-bounce
In the last line of the subject, two encoded-words are appended together
?==?not complying to this part of the RFC2047Also, I'm not sure that it has to create an encoded-word for this
=?utf-8?q?_?=, but I'm a bit lost in the specs.It is highly dependent to the number of chars and where the chars that need encoding are placed, as the same subject which does not start with "Re: " is fine
I could reproduce this behavior on 3.13.x, 3.14.2, 3.15-dev
Apologies if there already is an issue for this, I found several issues on the topic, but could not find a matching one.
CPython versions tested on:
CPython main branch, 3.15
Operating systems tested on:
Linux
Linked PRs