Skip to content
New issue

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

net/mail: Parsing address "foo@bar.com <foo@bar.com>" fails #39258

Closed
ThomasHabets opened this issue May 26, 2020 · 2 comments
Closed

net/mail: Parsing address "foo@bar.com <foo@bar.com>" fails #39258

ThomasHabets opened this issue May 26, 2020 · 2 comments

Comments

@ThomasHabets
Copy link
Contributor

@ThomasHabets ThomasHabets commented May 26, 2020

What version of Go are you using (go version)?

$ go version
go version go1.14 linux/amd64

Does this issue reproduce with the latest release?

Yes. And play.golang.org

What operating system and processor architecture are you using (go env)?

Debian Linux amd64

What did you do?

Try to parse an address using net/mail.

https://play.golang.org/p/PzvfiO0LVT7

package main

import (
	"fmt"
	"net/mail"
)

func main() {
	_, err := mail.ParseAddressList("foo@bar.com <foo@bar.com>")
	if err != nil {
		fmt.Println("Error: ", err)
	}
}

What did you expect to see?

For it to be accepted. I don't know if it's standards compliant, but it's unambiguous to me.

What did you see instead?

Parsing the address failed with an error. "Expected comma".

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented May 26, 2020

I believe this is correct according to RFC 5322. The @ character is not permitted in a comment, so foo@bar.com must be an e-mail address. There is then a comma missing before the next e-mail address, which is <foo@bar.com>.

@ThomasHabets
Copy link
Contributor Author

@ThomasHabets ThomasHabets commented May 26, 2020

Reading that more carefully, yes I think you're right. It works quoted, which also seems correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.