Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion sope-mime/NGMime/NGMimeHeaderFieldGenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@

static BOOL isPrintable(char ch) {
// match printable ASCII-characters according to https://tools.ietf.org/html/rfc2047#section-4.2
return ch >= 32 && ch < 127 && ch != '=' && ch != '?' && ch != '_' && ch != '.' && ch != ',' && ch != ';' && ch != ':' && ch != '@' && ch != '"';
// RFC 822 `specials` (`()<>[]:;@\,.")` must also be Q-encoded: a literal `[Org]`
// inside an encoded word breaks Dovecot's rfc822 parser, which then fabricates
// a recipient like `Name @MISSING_DOMAIN` (mailbox truncated at `[`, domain lost).
return ch >= 32 && ch < 127 && ch != '=' && ch != '?' && ch != '_'
&& ch != '(' && ch != ')' && ch != '<' && ch != '>'
&& ch != '[' && ch != ']' && ch != '\\'
&& ch != '.' && ch != ',' && ch != ';' && ch != ':' && ch != '@' && ch != '"';
}

@implementation NGMimeHeaderFieldGenerator
Expand Down