-
Notifications
You must be signed in to change notification settings - Fork 258
Carve email addresses enclosed in <>s #612
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
base: master
Are you sure you want to change the base?
Conversation
I agree this will extract the email address, but it also encourages people to provide invalid email addresses in the To/CC/etc. fields. |
How about uploaded emails, we'll have to correct them by hand? ;-) http://www.phpclasses.org/browse/file/14672.html |
I think this spells it out... https://tools.ietf.org/html/rfc2822#section-3.4 |
So that it only runs for the + button
Uploaded emails are my use case too. Eyballing those, the vast majority of headers are in the format of |
'''>>> import re''' You need to change it to re.compile(b''<(.+)>') |
It doesn't spell it out. Open up GMail, paste in "<Michael Goffin> mgoffin@gmail.com" for the To address, and see what happens. It fails because of the display name in the brackets. People expect proper email addresses for this stuff. That being said, these values are also used for generating Targets, and that will continue to break for you if you abuse the field. It's designed for email addresses (mgoffin@gmail.com), not complex addresses with display names and other nonsense. |
Reading through the RFC brings up some more interesting cases... |
So clearly, some processing needs to happen on the uploaded emails to convert from Address to Addr-spec. Otherwise, anyone uploading .msg or .eml files en-masse will not be a happy camper. |
Yep. I think options would be:
|
I'd prefer option two. It's more complex, but it covers building relationships in the possible case of an attacker that uses the same display name with different addresses. |
+1 on option two |
We've struggled with this same issue. Uploading email files has led to messy Email fields. |
I was looking at some of the python email libraries, so that we don't have to redevelop the wheel, and keep up with the corner cases.
And the output is:
There's some more example code at http://blog.magiksys.net/parsing-email-using-python-header |
While looking at an unrelated issue, it looks that we might run into a case where the message headers are encoded... https://www.ietf.org/rfc/rfc1342.txt, I think that should be handled before this happens. |
Useful when creating indicators out of email headers.