emersion / emersion/go-message

Bug with mail.ParseAddressList()

Open
#195 4 comments 0 reactions 0 assignees View on GitHub
non-standard
Dominant language
Go
Stars
458
Forks
129
PR merge metrics
No merged PRs in 30d

Description

Hello,

The `mail.ParseAddressList` function can't parse this address: `"name@yahoo.com "`, 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:

```Go
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("name@yahoo.com ")
spew.Dump(al, err)
}

{
// The address is extracted from .eml file received by Yahoo from ProtonMail
al, err := mail.ParseAddressList(`"name@yahoo.com" `)
spew.Dump(al, err)
}
}

```

Result :
```
➜ poc/ go run main.go
([]*mail.Address)
(*errors.errorString)(0x140000101a0)(mail: expected comma)
([]*mail.Address) (len=1 cap=1) {
(*mail.Address)(0x140000a41c0)("name@yahoo.com" )
}
(interface {})
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.