I would like to add an image as an Inline attachment and everything works fine using the following code
<img src="cid:logo.jpg">
in.addAttachment("cid:logo.jpg", new DataHandler(new FileDataSource("src/resources/logo.jpg")));
The only problem is that, I can not see the image as an inline attachment in Thunderbird because the content type is "application/octet-stream" but it must be "image/jpeg" in order to be shown correctly. When I add the MIME type in Apache Camel like this:
in.addAttachment("cid:logo.jpg", new DataHandler(new FileDataSource("src/resources/logo.jpg"), "image/jpeg"));
it throws and exception saying that "no object DCH for MIME type image/pjpeg" How can I deal with this problem?!
Create a DataSource as described in this JavaMail FAQ entry and use it in place of the FileDataSource in your first example.