-
Notifications
You must be signed in to change notification settings - Fork 111
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
Validating e-mails with display-name: John Doe <[email protected]> #116
Comments
https://github.com/mailgun/flanker can do that (and you could combine it with this library). (We link to flanker at the top of our README.) I think parsing display names could be a useful addition. |
Thanks, this helped! |
Flanker's lack of maintenance (and dependency on unmaintained packages) is beginning to break in modern versions of Python (3.13 specifically.) For extracting the email from the display name you can use Python's built-in |
Great suggestion. 😀 |
I was thinking of replacing flanker with parseaddr in the recommendation in the README, but I see the parseaddr is a little flaky with edge cases. Just from a minute of playing I see it drops parts of the input it doesn't like:
So it's not something I would necessarily recommend to use with a strict validation tool like this library. |
Flanker doesn't accept For my specific use, I don't care much about those cases, so I think it's a good enough solution :) |
Fair point ! |
Per request in #116, parse display name syntax also, but don't allow it unless a new allow_display_name option is set. Parsing according to the MIME specification probably isn't what's generally wanted since the use case is probably parsing inputs in email composition-like user interfaces. So it's in the spirit of a MIME message but not the letter. If display name syntax is used, return the unquoted/unescaped display name in the returned object.
Per request in #116, parse display name syntax also, but don't allow it unless a new allow_display_name option is set. Parsing according to the MIME specification probably isn't what's generally wanted since the use case is probably parsing inputs in email composition-like user interfaces. So it's in the spirit of a MIME message but not the letter. If display name syntax is used, return the unquoted/unescaped display name in the returned object.
Per request in #116, parse display name syntax also, but don't allow it unless a new allow_display_name option is set. Parsing according to the MIME specification probably isn't what's generally wanted since the use case is probably parsing inputs in email composition-like user interfaces. So it's in the spirit of a MIME message but not the letter. If display name syntax is permitted, return the unquoted/unescaped display name in the returned object.
Hi, Just wanted to let you know I just moved from v2.1.2 to the current git branch to test out the allow_display_name option and ran into a difference with it from the previouly mentioned workarounds. i've been using the I know you may not want to handle emails in this format, but thought the difference should be documented somewhere. thanks for all you do!
|
Huh. What I implemented follows RFC 2822's
I'm not sure what the source of a |
It might just be a qmail or older postfix or freebsd thing. I don't see it often, but when I do, and if it came from a message, it normally also has a Received header from either qmail or postfix. And I used to rent a freebsd server and whenever I would use their mailing list functions, my outgoing emails would look like that as well. It's not super common, but common enough that I would have to work around the execptions, so I am prob going to just stick with email.utils.parseaddr. (I know it also has weird edgecase behavior, but it's mishandling of edgecases hasn't effected my dataset in a meaningful way yet) Hmm, just stumbled across this (from 2014): I thought I saw some other mention around here about ignoring comments in ()'s |
We recently had an e-Mail with the display name "TIERE (gemeinnütziger Verein) Max Müller". As it contains Umlaute and Brackets, it did not work with
It looked to me as if |
Ahha! That makes sense. Comments came up in #77. As fun as it has been to implement display names, I probably am not going to get motivated to support comments.
Good to know! |
Hi,
in my use-case I need to validate the syntax of e-mails with display name. I think, https://www.rfc-editor.org/rfc/rfc5322#section-3.4 fully allows addresses like "
John Doe <[email protected]>
" or in my case something like "ACME Corp. <[email protected]>
".I did not find a way to verify these addresses with yours or any other library. It would be great if your library could validate this too ;-).
Warm regards,
thorsten
The text was updated successfully, but these errors were encountered: