Skip to content

fix(mime): Q-encode RFC822 specials in header words - #76

Closed
tobias-weiss-ai-xr wants to merge 1 commit into
Alinto:masterfrom
tobias-weiss-ai-xr:fix/encodeAddressBrackets
Closed

tobias-weiss-ai-xr wants to merge 1 commit into
Alinto:masterfrom
tobias-weiss-ai-xr:fix/encodeAddressBrackets

Conversation

@tobias-weiss-ai-xr

@tobias-weiss-ai-xr tobias-weiss-ai-xr commented Sep 15, 2026 •

Copy link
Copy Markdown

Display names such as 'Surname, Firstname [Org]' (Surname, Firstname [Org], common in collected-address book entries) were Q-encoded as '=?utf-8?q?Firstname=2C_Lastname_[Org]?=' - the comma forces the encode path, but '[' and ']' stayed literal bytes inside the encoded word.

Dovecot's rfc822 parser treats that literal '[' as a domain-literal opening, never reaches the real and fabricates a recipient with its MISSING_DOMAIN fallback (mailbox truncated at '[', host lost). SOGo then renders the Dovecot envelope verbatim, e.g. To: 'Surname, Firstname @MISSING_DOMAIN'.

Exclude the full RFC 822 specials set (( ) < > [ ] \ . , ; : @ ") from 'printable' so Q-encoding escapes them (=5B/=5D=40 etc.).

Display names such as 'Surname, Firstname [Org]' (a common collected-address
convention) were Q-encoded as '=?utf-8?q?Surname=2C_Firstname_[Org]?=' - the
comma forces the encode path, but '[' and ']' stayed literal bytes inside the
encoded word.

Dovecot's rfc822 parser treats that literal '[' as a domain-literal opening,
never reaches the real <addr> and fabricates a recipient with its
MISSING_DOMAIN fallback (mailbox truncated at '[', host lost). SOGo then
renders the Dovecot envelope verbatim, e.g. To: 'Surname, Firstname @MISSING_DOMAIN'.

Exclude the full RFC 822 specials set (( ) < > [ ] \ . , ; : @ ") from
'printable' so Q-encoding escapes them (=5B/=5D etc.). Verified:
'Surname, Firstname [Org]' now encodes to the round-trip-safe
'=?utf-8?q?Surname=2C_Firstname_=5BOrg=5D?=' which Dovecot parses with correct
mailbox host.
@tobias-weiss-ai-xr tobias-weiss-ai-xr closed this by deleting the head repository Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant