Repository navigation
Fix: Parse address headers with non-UTF-8 display names - #763
Merged
Merged
Conversation
Owner
|
Thank you |
axllent
added a commit
that referenced
this pull request
Nov 2, 2026
The helper added in #763 used enmime.ParseAddressList, which decodes encoded words inside the address itself and inserts missing commas. This made it differ from net/mail: a local part such as [email protected] became [email protected]@example.com, and comma-less lists were split into extra recipients. Parse with net/mail and only extend the charset reader used for display names, so addresses are never decoded and malformed lists are rejected as before. Also use the helper for sendmail -t recipients.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mail.Header.AddressListcannot decode display names in charsets such as ISO-2022-JP, Shift_JIS or windows-1252. Mailpit ignores that error in the SMTP Bcc check, so To and Cc recipients with those names look missing and are added to an injectedBccheader. Release returns an error for the same reason when the From name uses one of those charsets.This adds
tools.AddressList, which parses the header withenmime.ParseAddressList, and uses it in the SMTP Bcc check, release andingest. Storage already uses enmime for these headers, so there is no new dependency.enmime is more tolerant of malformed lists, for example a missing comma between addresses. These code paths now accept what storage already accepted.
Reproduced against
develop(75d9473) and this branch with the same ISO-2022-JP message:Bccfrom the API[email protected]Bcc:header in the raw messagebcc:[email protected]Related issues
#762
Type of change
Test plan
TestScanAddressesInHeaderCharsets. It fails ondevelopfor ISO-2022-JP, Shift_JIS, EUC-JP and windows-1252, and passes here.TestAddressList.go testpackages from.github/workflows/tests.yml.Bccappeared.AI assistance disclosure
Please indicate whether AI tools (e.g. Claude, Copilot, ChatGPT, Cursor) were used in preparing this pull request:
If AI was used, briefly describe how (which tools, and for what parts):
Claude Code found the bug, wrote the fix and tests, ran the checks above, and drafted this description. I reproduced the bug and reviewed the change.
Checklist