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

Outlook MSG to EML String Parses "Content-ID" Incorrectly #307

Closed
darb1353 opened this issue Mar 15, 2021 · 4 comments
Closed

Outlook MSG to EML String Parses "Content-ID" Incorrectly #307

darb1353 opened this issue Mar 15, 2021 · 4 comments

Comments

@darb1353
Copy link

darb1353 commented Mar 15, 2021

Hello,

This is the workflow I'm attempting to achieve using Simple Java Mail:

  1. Save Outlook MSG
  2. Convert Outlook MSG to EML string
  3. Save EML String to .eml file
  4. Re-open .eml file in Outlook
  5. See the same file

Everything works except for embedded images do not parse correctly because of the "Content-ID" not being set correctly. I believe.

The issue manifests as such:
Given this email in Outlook with an embedded image:
image

I then run it through this line of code:
String emlStr = EmailConverter.outlookMsgToEML(file);

I then save out the "emlStr" to a file and open it in Outlook to see this:
image

Basically, the file is now attached and not embedded. And it can't be found because of a filename change.

The reason I think the problem lies in the "Content-ID" is because of this in the EML file script, I see this:
image
The HTML email is there with the <img> tag and src="cid:image001.png@01D719B4.37AF4500"
However, notice the line Content-ID: <image001.png@01D719B4>
It's missing the last part of the src name from the img tag. In looking at your source, this seems to happen here in your source.

Why do you strip the file's extension type off the resource name for Content ID?

What are your thoughts? Am I doing something wrong in using your library?

This is one of my first times doing this, if I should submit this in a different format, please let me know.

@bbottema
Copy link
Owner

This behaviour stems from the attachment detection algorithm, which deals with extensions in a certain way. Obviously this is a bug you found, so thank you for bringing it up!

I'll take a closer look in the next few days.

@bbottema
Copy link
Owner

Can you provide a sample email so I can reproduce the exact problem? That would help me a lot.

@darb1353
Copy link
Author

Here is the example email from my initial post. Just an email with an embedded image.
EmbeddedPicture.zip

bbottema added a commit that referenced this issue Apr 10, 2021
…e. I'm not sure why this was in there in the first place, but it was causing bugs, so I just removed it completely. Good riddance.
@bbottema bbottema added this to the 6.5.1 milestone Apr 10, 2021
@bbottema
Copy link
Owner

I found the cause and fixed it promptly. Released in v6.5.1!

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