Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inline image display in mail body

 
SoumyaGh Ghosh
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 297
5
Android Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
SoumyaGh Ghosh
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20756
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic