How do I display the image sent as an attachment with the mail in JSP while retrieving the mails?

John Zukowski

If the message came across as text/html content, just send the HTML out as the output of the JSP request. All the different IMG tags will make separate requests to the server to display the images.

The only real problem is if the images come across with the JavaMail message and have a URL that begins with a cid: URL (as demonstrated in How do you send HTML mail with images?). If that is the case, then you deal with sending the image yourself (and saving it locally). You can try to create a protocol handler for cid, but I think the best way is to convert the URL into one that is handled by default, like any other image, with an HTTP request.