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

emlToEmail() and mimeMessageToEmail() break on mesages with duplicate names and legacy empty nested messages #351

Closed
atmcq opened this issue Nov 12, 2021 · 9 comments
Assignees
Milestone

Comments

@atmcq
Copy link

atmcq commented Nov 12, 2021

See examples attached. All 3 email files have 2 attachments, however only outlookMsgToEmail() is picking up both of them, emlToEmail() and mimeMessageToEmail() only pick up one attachment.

We will grab the source and try to debug but if there is any chance you know what this might be please let me know as we have a customer problem with this one.

MimeProblem.zip

/edit bbottema: partial regression bugs for #219, #249, #310. Also solves #332

@bbottema
Copy link
Owner

bbottema commented Nov 14, 2021

Actually in the latest working code it even throws an exception on account of missing filenames/datasource names. It seems the filename is missing from the EML data and it simply leaves the name empty. I don't see any name information in the multipart data either, but Thunderbird simply names both "ForwardedMessage" (which doesn't occur in the whole EML raw data).

Must have been sent with a version of Outlook that worked slightly differently when naming these specific attachments (using "thread-topic" property from the attached email).

Fixing that, it again finds only 1 attachment.

@bbottema
Copy link
Owner

I figured out why (in the current code at least): the attachments are both named the same and currently attachments with same name are not allowed. I'll fix that and commit it to the develop branch. But I don't think I can do a release any time soon as I'm in the middle of a bunch of changes for the 7.0.0 release.

@bbottema
Copy link
Owner

bbottema commented Nov 14, 2021

Hmm, oddly, I changed it to that for #249 (MimeMessageParser doesn't handle multiple attachments with the same name correctly)

Upon further inspection, it seems like a regression bug, but I don't know why. Why did I change the attachment list from Set<Map.Entry<String, DataSource>> to Map<String, DataSource>? Was it so that attachments are sorted and did I accidently remove support for duplicate file names?

Interestingly, the original solution had a bug as well, which I now fixed.

bbottema added a commit that referenced this issue Nov 14, 2021
…ames as Outlook derives it from the nested message's header 'threat-topic'). Current solution is to name the attachment ForwardedMessage.eml (copying Thunderbird)
@bbottema
Copy link
Owner

bbottema commented Nov 14, 2021

Ok, fixed in develop. Thanks so much for your test data! Will be released in 7.0.0 some day.

@bbottema bbottema added this to the 7.0.0 milestone Nov 14, 2021
@bbottema bbottema self-assigned this Nov 14, 2021
@atmcq
Copy link
Author

atmcq commented Nov 14, 2021

Thanks for picking this up so quick. Is there any way you could add an option to use an Outlook style approach, e,g. to use Thread-Topic for the attachment name, rather than the Thunderbird style "ForwardedEmail.eml"? We have a few legal industry customers that really don't like the idea of an email that they send in to our app "changing" (in their words), as they are coming from using exclusively Outlook.

@bbottema
Copy link
Owner

bbottema commented Nov 14, 2021

That's tricky because the name is set before any nested messages are processed. The code would need to be adjusted so that the name is updated after parsing its associated message and then only if it contained the header thread-topic (if that is indeed the canonical approach to handling Outlook messages). Not saying it can't be done, but I haven't looked into that.

@atmcq
Copy link
Author

atmcq commented Nov 15, 2021

Is there any possibility of porting this fix into a 6.6.2 release? This is causing us some difficulties with some customers.

if that isn't possible, do you have a rough ETA for 7.0.0? Finally if you don't please let us know so we can look into branching and fixing ourselves for now (I assume https://github.com/bbottema/simple-java-mail/commit/9d8dda88dc529f94c2ffaee42b86482936a70454 and https://github.com/bbottema/simple-java-mail/commit/a20655acd6a9960fc8ec4a6a4167299ba452a54e is what we'd need).

@atmcq
Copy link
Author

atmcq commented Nov 16, 2021

FYI we have done a quick branch of simple-java-mail-6.6.1.jar for now, and will pick up 7.0.0 when it is released. Thanks for your help on this.

bbottema added a commit that referenced this issue Dec 25, 2021
…ames as Outlook derives it from the nested message's header 'threat-topic'). Current solution is to name the attachment ForwardedMessage.eml (copying Thunderbird)
bbottema added a commit that referenced this issue Dec 25, 2021
@bbottema bbottema modified the milestones: 7.0.0, 6.6.3 Dec 25, 2021
@bbottema bbottema changed the title emlToEmail() and mimeMessageToEmail() missing off attachments emlToEmail() and mimeMessageToEmail() break on mesages with duplicate names and legacy empty nested messages Dec 25, 2021
@bbottema
Copy link
Owner

Released in 6.7.0. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants