-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
Bug: names manually specified for embedded images are overridden and have extension added, breaking cid: references in HTML body #440
Comments
Sure, have a look here. |
Hi, Thanks for the update. I have seen the link you shared. I think i was not clear in my question. Could you please support ?
|
Well, this is a core feature of the library and has been tested in many clients for the past 14 years, so I'm inclined to think this is either an issue with the data you are embedding or an issue with your email client. However, without concrete data I can't say more, the API usage seems fine. Perhaps you can share the EML text that comes out? For example using |
Hi, Thanks for the update. As we have a strict security policy, I will be unable to provide EML text. I printed the EML for embeddedImages. Below is the last part of EML which includes data for embeddedImages and the debug logs associated with it .
|
Yes, this looks good to me. For reference, here's the email from the included demo which I just checked still works as it should:
Although, two questions.
|
Thanks for your support. The issue has been resolved. |
@bbottema I faced same problem. After read the source code, I realized that if I add image like this emailBuilder.withEmbeddedImage("test", new FileDataSource(file)); // filename is abc.png The |
This issue escaped my attention, it seems. This is a particularly complicated algorithm, which is tricky to change due to various different use cases that depend on the id's used for attachments. But I'll have a look, because this functionality is extensively tested in junit tests, so it should be easy to either rule it out or reproduce it. |
On the other hand, I can clearly see the Content-ID seems wrong, which is linked to the cid: references. I'll dive into this code once again soon. I think maybe the problem with not having the extension, when it is not referenced by cid:, email clients will assume it should be an attachment. But then if you didn't also provide the right extension with the custom name, email clients such as Outlook will simple use the provided name as attachment file name. For these cases, I make sure the attachments always have the right extension for optimal behaviour in email clients. (this is all from faint memory, so I might be wrong) However, this does mess with the Content-ID and causes problems if you do reference it with cid: in your HTML body. Maybe I can make it more intelligent, by first checking if there is a cid: references for a specified attachment name. If not, only then append the correct file extension (or maybe drop it completely, but I have to assume my users provided the name for a reason, on the other hand I do modify it with extension... hmm). |
…n and have extension added, breaking cid: references in HTML body - now only fixing file extension in case of attachments, not inline attachments (embedded images)
I've nailed down the bug and fixed it. It was a pain to deal with the junit tests, due to the fact that during generation of the MimeMessage (EML) the attachment names change. Then reading the resulting mail back and comparing it with the initial email requires some complicated tinkering involving reflection. Anyway, fix released in 8.3.1. Enjoy. |
Greetings,
Could you please let me know how to use withEmbeddedImages feature while sending emails ?
I tried to use both withAttachments and withEmbeddedImages in the same manner.
Only withAttachments work fine. withEmbeddedImages fail to display the images inline in the email.
Please Support.
The text was updated successfully, but these errors were encountered: