Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
net/mail: correctly handle whitespaces when formatting an email address #6641
net/mail: correctly handle whitespaces when formatting an email address Whitespace characters are allowed in quoted-string according to RFC 5322 without being "Q"-encoding. Address.String() already always formats the name portion in quoted string, so whitespace characters should be allowed in there. Currently, http://play.golang.org/p/wQGqBhvbXL produces =?utf-8?q?First_Last?= <firstname.lastname@example.org> but it contains no non-ASCII characters, so it should format to "First Last" <email@example.com> https://golang.org/cl/15380044/
Comment 1 by firstname.lastname@example.org:
I also wanted to report this bug. According to RFC 5322 email address should follow these rules: name-addr = [display-name] angle-addr display-name = phrase phrase = 1*word / obs-phrase word = atom / quoted-string atom = [CFWS] 1*atext [CFWS] So a phrase of (printable ascii) words separated by whitespace is also allowed.