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

proposal: net/mail: special error for empty group address #28638

Closed
neganovalexey opened this issue Nov 7, 2018 · 2 comments
Closed

proposal: net/mail: special error for empty group address #28638

neganovalexey opened this issue Nov 7, 2018 · 2 comments

Comments

@neganovalexey
Copy link
Contributor

@neganovalexey neganovalexey commented Nov 7, 2018

Empty group address is often used to hide email recipients, for example,

To: undisclosed-recipient:;

(http://www.postfix.org/postconf.5.html#undisclosed_recipients_header)

The mail.ParseAddress() function returns nil and error on such inputs now, and this error ("mail: empty group") is not exported. Hence it is difficult to parse a wide range of emails.
I suggest to declare an exported error variable that could be used to detect the case. It will not change behavior of any existing Go program, but it will significantly help for email parsing.

@gopherbot gopherbot added this to the Proposal milestone Nov 7, 2018
@gopherbot gopherbot added the Proposal label Nov 7, 2018
@rsc
Copy link
Contributor

@rsc rsc commented Nov 28, 2018

If you parse

To: undisclosed-recipient:;
To: Joe <joe@joe.com>
To: Joe <joe@joe.com>, Jane <jane@jane.com>

with ParseAddress, then only the second case will succeed. ParseAddress means 1 address. So don't you want ParseAddressList anyway, which accepts both 0 and 2 addresses? And then you shouldn't need this error to be exported.

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 29, 2018

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Dec 29, 2018
@golang golang locked and limited conversation to collaborators Dec 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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