aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes inline image display in mail body Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "inline image display in mail body" Watch "inline image display in mail body" New topic
Author

inline image display in mail body

SoumyaGh Ghosh
Greenhorn

Joined: Mar 02, 2013
Posts: 4
Hi,
I have a requirement to create a mailbox kind of thing, for that I need to poll specific inbox of email ids from mail server. I am doing these things using JavaMail. I need to show all mails as inbox type and user can reply/forward those also. I have generated an HTML page with contenteditable div where everything is coming. But inline images are not showing in mail body i.e. within contenteditable div. it's coming as separate attachment. In html source I am seeing that inline images are generally referred as cid:image001 type which is not being referred from my web application. Any idea how can I show those images within mail body? or where those cid:image... exactly exists? Because from outlook or Lotus Notes web mail also it is visible.

Regards
Soumya
Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 295
    
    5

The images will be attachments on the email. The image001 in cid:image001 will be the value of the Content-Id attribute in the MIME headers for the attachment.


Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
SoumyaGh Ghosh
Greenhorn

Joined: Mar 02, 2013
Posts: 4
Thanks Rob for your reply.

What I am seeing is it's coming in the mail body as src="cid:image001". Is it the case that if Content_Id attribute of MIME header will be same of the src... then, image will be loaded inline? While reading from MailServer, doesn't any mail client store the image in any location? If not, how it will load the image? It would be great if you can please elaborate your view.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

I googled for a bit (keywords: javamail embedded images) and found for example this: http://javacoalface.blogspot.ca/2012/08/how-to-use-javamail-to-send-email-with.html

That isn't the only example those keywords returned, there were a lot more.
SoumyaGh Ghosh
Greenhorn

Joined: Mar 02, 2013
Posts: 4
Hi Paul,

Thanks for the reply. This example is for embedding inline image while sending a mail. It's setting a content-id in header and picked up the image from physical location like new File("./icon.jpg").
But I am facing problem during reading of a mail with inline image. Mail content is coming fine except the inline image part. "X" mark is coming at that image, that means it's not finding the image from the source mentioned in mail body. Please suggest ideas on it.

Regards
Soumya
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41843
    
  63
SoumyaGh Ghosh wrote:But I am facing problem during reading of a mail with inline image. Mail content is coming fine except the inline image part. "X" mark is coming at that image, that means it's not finding the image from the source mentioned in mail body.

It could also mean that images are not loaded (which is the default for many web mailers). What tool are you using to read the mail?

Also be aware that there are people and/or mail clients out there that refuse to deal with HTML mail, so you'd do well to also provide a text-only mail that has the images as attachment if they're important.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: inline image display in mail body