We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the net/mail package, Address is used to generate a valid RFC 5322 address. ParseAddress is used to parse a single RFC 5322 address.
net/mail
Address
ParseAddress
There is currently a bug if the address name contains parentheses.
The following code fails to run:
package main import "fmt" import "net/mail" func main() { tests := []*mail.Address{ {Name: "Robert Müller", Address: "bob@example.com"}, {Name: "Robert (Bob) Müller", Address: "bob@example.com"}, } for i, in := range tests { fmt.Printf("\nTest %d\n", i) // straight encoding, will use q-encoding if needed fmt.Printf("In: %s\n", in) // decode the q-encoding out, err := mail.ParseAddress(in.String()) if err != nil { // oops! cannot parse our own address? panic(err) } // should match our earlier q-encoding fmt.Printf("Out: %s\n", out) } }
Expected output:
Test 0 In: =?utf-8?q?Robert_M=C3=BCller?= <bob@example.com> Out: =?utf-8?q?Robert_M=C3=BCller?= <bob@example.com> Test 1 In: =?utf-8?q?Robert_(Bob)_M=C3=BCller?= <bob@example.com> Out: =?utf-8?q?Robert_(Bob)_M=C3=BCller?= <bob@example.com>
Actual output:
Test 0 In: =?utf-8?q?Robert_M=C3=BCller?= <bob@example.com> Out: =?utf-8?q?Robert_M=C3=BCller?= <bob@example.com> Test 1 In: =?utf-8?q?Robert_(Bob)_M=C3=BCller?= <bob@example.com> panic: mail: no angle-addr goroutine 1 [running]: main.main()
See it in action here.
These functions should be symmetric if I correctly understand the documentation.
The text was updated successfully, but these errors were encountered:
This is a duplicate of #11292 and it has already been fixed in Go1.6.
You can already use Go1.6beta2 where this bug is fixed if you want: https://groups.google.com/forum/#!topic/golang-nuts/DUwMjOWLA6s
Sorry, something went wrong.
Great to hear! Thank you very much.
No branches or pull requests
In the
net/mail
package,Address
is used to generate a valid RFC 5322 address.ParseAddress
is used to parse a single RFC 5322 address.There is currently a bug if the address name contains parentheses.
The following code fails to run:
Expected output:
Actual output:
See it in action here.
These functions should be symmetric if I correctly understand the documentation.
The text was updated successfully, but these errors were encountered: