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

mail.ParseAddress does not conform to rfc5322 #39591

Open
graywolf opened this issue Jun 15, 2020 · 6 comments
Open

mail.ParseAddress does not conform to rfc5322 #39591

graywolf opened this issue Jun 15, 2020 · 6 comments

Comments

@graywolf
Copy link

@graywolf graywolf commented Jun 15, 2020

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

I'm not sure how to get this information from play.golang.org.

Does this issue reproduce with the latest release?

yes

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

I'm not sure how to get this information from play.golang.org.

What did you do?

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

What did you expect to see?

<foo.x.bar@bar.com> <nil>

What did you see instead?

<nil> mail: no angle-addr
@davecheney
Copy link
Contributor

@davecheney davecheney commented Jun 15, 2020

Section 3.2.3 suggests that the local part of an address may be a dot-atom or a quoted string, but not a combination of both as your example shows. Do mail clients accept this address?

@graywolf
Copy link
Author

@graywolf graywolf commented Jun 15, 2020

There is also section 4.4 describing obs-local-part = word *("." word) so that email address should be valid. Also mail send like

$ sendmail -t
From: me@some.domain
To: foo."x".bar@some.domain
Subject: Test

Test.

does arrive.

Note: While section 4 is obsolete, it must be accepted.

Though these syntactic forms MUST NOT be generated according to the grammar
in section 3, they MUST be accepted and parsed by a conformant receiver.

@davecheney
Copy link
Contributor

@davecheney davecheney commented Jun 15, 2020

I read “.” as one literal period character

@graywolf
Copy link
Author

@graywolf graywolf commented Jun 15, 2020

Well yeah, so the obs-local-part in foo."x".bar should be evaluated like atom "." quoted-string "." atom, which looks valid based on:

obs-local-part  =   word *("." word)
word            =   atom / quoted-string

Am I reading the RFC wrong?

@davecheney
Copy link
Contributor

@davecheney davecheney commented Jun 15, 2020

Tbh I’m not sure. What’s your use case? Do you have a need to accept this form of address?

@graywolf
Copy link
Author

@graywolf graywolf commented Jun 15, 2020

I've tried to put list of valid email addresses [0] through our email validation and some did not pass. So it seemed reasonable to open a bug report about this. If full RFC 5322 compatibility is not a desired goal, then this can be closed.

[0] https://github.com/StoneCypher/testdata-valid-email/blob/master/testdata-valid-email.js

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.