Search code examples
javahtmloutlookjakarta-mail

Is there a way to send Email in Java where the jpeg images in the HTML email get automatically downloaded and displayed in outlook?


I am sending emails using Java Mail API.

It has HTML content and has some jpeg images. Is there any flag or any header which will make outlook display the images inside it automatically, without the user actually clicking "download content" link ?

I can see the images in gmail, but not when I use outlook. Even if there are some flags would it be against the security?

Also if there is png it is displayed automatically in outlook, but not jpegs.


Solution

  • Not for the external images. You can add images to the message as attachments, set the Content-ID MIME header on the attachments, and refer to the images in the HTML body by their content-id (e.g. <image src="cid:xyz"> where xyz is the attachment content id.