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: interpret comment after address as display name #22670
Comments
I assume this would be a fallback - so Are there any cases where the name is missing and the comment is used for a different purpose? I am also wondering if it would be useful to somehow make this difference visible to the developer. Otherwise, |
Correct
I haven’t seen any so far, but of course that doesn’t mean such cases don’t exist.
I’m not sure why a developer would need to concern themselves with this subtle detail of email parsing? :) |
My knowledge of email address formats is limited, so I was simply trying to clarify the proposal a bit and see if there would be any noticeable disadvantages to accepting it. It also seems like putting display names in the comments has been discouraged since 1982: https://wordtothewise.com/2014/12/friendly-email-addresses/:
RFC: http://tools.wordtothewise.com/rfc/822 Nevertheless, if this practice is still common, it seems okay to me to support it as a fallback. |
Yep, I’m aware of the RFC :). We can of course also file bugs against mutt, neomutt, gnus and debbugs to use a more modern addr-spec, but that won’t fix the messages in my archives, which is why I’m starting to work on this end of the issue first. |
That makes sense. I guess the only drawback of doing it would be that we'd be encouraging the bad behavior - but it's clearly too late for that :) The point about being able to use email archives is useful, though. golang.org/s/owners just lists @bradfitz as maintainer - any thoughts, Brad? I realise the package is frozen, but this would not increase or change its API. |
Wouldn't be dangerous to put in Even if I mean, it would be pretty reasonable to assume that This is true now, but if we start parsing
as
that assumption breaks. The point is that when you write |
RFC822 states “Many MUAs will display that comment as though it were the display name”. I understand this as: one should expect comments in the I can’t quite see any danger in implementing what an RFC states is common practice, and only affects a fallback code path. Even in the unlikely event that this case actually exists anywhere (do you have any real-world examples of this edge case?), I would maintain that treating such a comment as display name is actually sensible — most likely it will identify the author of the message. |
If, when present, the |
Per @golang/proposal-review, if there's just one comment after the address, sure, let's make it the Name. CL welcome for Go 1.11. |
Thanks! I’ll try to send a CL tomorrow. |
Change https://golang.org/cl/77474 mentions this issue: |
It looks like handling comments at all is new in Go 1.10. Given that, we might as well fix this now and avoid having a release that handles but drops comments. |
In #21257, we implemented skipping comments, resulting in e.g. “foo@bar.com (Foo Bar)” parsing into
Address{Name: "", Address: "foo@bar.com"}
.I’d like to propose interpreting comments as display name, as various fairly common mail user agents still use them like that these days. Here are a few examples:
From: md@Linux.IT (Marco d'Itri)
Date: Thu, 5 Oct 2017 14:42:30 +0200
User-Agent: NeoMutt/20170609 (1.8.3)
From: owner@bugs.debian.org (Debian Bug Tracking System)
Date: Sat, 07 Oct 2017 05:21:04 +0000
From: yumkam+debian@gmail.com (Yuriy M. Kaminskiy)
Date: Tue, 01 Aug 2017 22:42:55 +0300
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Thoughts?
cc @minaevmike, who worked on this code last
The text was updated successfully, but these errors were encountered: