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: Empty quoted display name should be allowed in email address #14866
Pass an email address with an empty quoted name, like:
The email address should parse without error
Error returned: mail: missing word in phrase: mail: empty quoted-string
We don't experience this problem on Go 1.4. I found that the offending change was in commit bd1efd5. The first release containing this change was 1.5, which corroborates the difference I've seen between the behavior in 1.4 and 1.5.
The change in
RFC5322 section 3.2.4 defines quoted string as:
For what it's worth, we're using the github.com/go-gomail package to create the message. If you pass it an empty name, it always puts
Even if my interpretation of the RFC were wrong and current Go behavior is right, the tests are clearly not thinking about this specific case, and they should be expanded to do so.
Here is a play.golang.org reproduction of the bug: http://play.golang.org/p/iSjSINU-Dm
I think this is fixed easily by removing https://github.com/golang/go/blob/master/src/net/mail/message.go#L444.
If the 'if statement' on line 444 is removed then ParseAddress(""John Doe" <""@example.com>") returns
So that should be fixed too.