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

getFromEmailFromHeaders cannot handle "quoted-name-with@at-sign" #43

Closed
basinilya opened this issue Jun 24, 2021 · 4 comments
Closed

getFromEmailFromHeaders cannot handle "quoted-name-with@at-sign" #43

basinilya opened this issue Jun 24, 2021 · 4 comments
Milestone

Comments

@basinilya
Copy link
Contributor

Even though Sender Name and Email addresse are stored in the fields 0xc1f and 0x42 respectively, the parser extracts and overwrites this info from the transport headers 0x7d.

If such a header contains quoted name with an @ at sign:

From: "bogus@domain.com" <bogus@domain.com>

it wrongly calls setFromEmail("\"bogus@domain.com\"", true)

When trying to use this e-mail with javax.mail it fails:

Caused by: javax.mail.internet.AddressException: Missing final '@domain' in string ``"bogus@domain.com"''
	at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:1279)

Please consider reusing or copying new javax.mail.internet.InternetHeaders(InputStream) for splitting the headers and new javax.mail.internet.InternetAddress(String) for parsing the address string.

@bbottema
Copy link
Owner

It seems you have a better grasp of the internal Outlook model than I have. Would you be interested in providing pull requests? I would be happy to integrate any improvements you might have.

@basinilya
Copy link
Contributor Author

basinilya commented Jun 26, 2021

Give me some time. Meanwhile I figured out it's not easy to construct a test .msg file for reproduction. The bug is only visible when 7d HEADERS is the last property seen. However, poi traverses the properties binary tree in a way that does not maintain the index order. So in my test message 7d HEADERS is followed by 65 SENT REPRESENTING EMAIL ADDRESS

@basinilya
Copy link
Contributor Author

Attached the test file. (deleted property 65 with FlexHex, I hope it doesn't corrupt the message too much)
Test at sign in personal From header.msg.zip
getFromEmail() is expected to return "bogus@domain.com", but it actually returns "\"bogus@acme.com\""

basinilya added a commit to basinilya/outlook-message-parser that referenced this issue Jun 26, 2021
basinilya added a commit to basinilya/outlook-message-parser that referenced this issue Jun 26, 2021
basinilya added a commit to basinilya/outlook-message-parser that referenced this issue Jun 27, 2021
basinilya added a commit to basinilya/outlook-message-parser that referenced this issue Jul 1, 2021
basinilya added a commit to basinilya/outlook-message-parser that referenced this issue Jul 1, 2021
basinilya added a commit to basinilya/outlook-message-parser that referenced this issue Jul 1, 2021
@bbottema bbottema added this to the 1.7.10 milestone Jul 1, 2021
@bbottema
Copy link
Owner

bbottema commented Jul 1, 2021

Fix released in 1.7.10. Thank you for your work!

@bbottema bbottema closed this as completed Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants