You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed that Address.String() and ParseAddress() functions don't match RFC 5322, especially regarding quoted-strings, and some other special cases.
Most simple way to find out if Address.String() and ParseAddress() do their job, is to look if a parsed and formatted mail address can be parsed again, which isn't the case: https://play.golang.org/p/Kl0FDI-BxO
package main
import"fmt"import"net/mail"funcmain() {
a, _:=mail.ParseAddress(`" "@test.com`)
fmt.Println(`" "@test.com`)
fmt.Println(a)
_, err:=mail.ParseAddress(a.String())
fmt.Println(err)
fmt.Println()
a, _=mail.ParseAddress(`"hello@world"@test.com`)
fmt.Println(`"hello@world"@test.com`)
fmt.Println(a)
_, err=mail.ParseAddress(a.String())
fmt.Println(err)
}
I fixed this problem, and wrote tests for other special cases: https://go-review.googlesource.com/#/c/8724/
I created this patch request a month ago, but hadn't got any answer unfortunately...
The text was updated successfully, but these errors were encountered:
I have noticed that
Address.String()
andParseAddress()
functions don't match RFC 5322, especially regarding quoted-strings, and some other special cases.Most simple way to find out if
Address.String()
andParseAddress()
do their job, is to look if a parsed and formatted mail address can be parsed again, which isn't the case: https://play.golang.org/p/Kl0FDI-BxOI fixed this problem, and wrote tests for other special cases: https://go-review.googlesource.com/#/c/8724/
I created this patch request a month ago, but hadn't got any answer unfortunately...
The text was updated successfully, but these errors were encountered: