-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Labels
Description
Hello,
The mail.ParseAddressList function can't parse this address: "[email protected] <[email protected]>", which is sent to me by ProtonMail. I have no idea if this is a valid format or not, but since this is production data used by a well-known service, I'm thinking it would be good to support this format.
Here's a PoC and the current result:
package main
import (
"github.com/davecgh/go-spew/spew"
"github.com/emersion/go-message/mail"
)
func main() {
{
// The address is extracted from .eml file sent by ProtonMail to Yahoo
al, err := mail.ParseAddressList("[email protected] <[email protected]>")
spew.Dump(al, err)
}
{
// The address is extracted from .eml file received by Yahoo from ProtonMail
al, err := mail.ParseAddressList(`"[email protected]" <[email protected]>`)
spew.Dump(al, err)
}
}Result :
➜ poc/ go run main.go
([]*mail.Address) <nil>
(*errors.errorString)(0x140000101a0)(mail: expected comma)
([]*mail.Address) (len=1 cap=1) {
(*mail.Address)(0x140000a41c0)("[email protected]" <[email protected]>)
}
(interface {}) <nil>