Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

embed the jpg to the email (it's attached)  RSS feed

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When receiving an email from my java application I get the text in perfect condition (html) but the jpg (which is the logo) is attached to email and not embedded to it.

I�m using this:

//picture
MimeBodyPart mbp2 = new MimeBodyPart();
FileDataSource fds = new FileDataSource("logo.jpg");
mbp2.setFileName(fds.getName());
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setHeader("Content-ID","<23abc@pc27>");
mp.addBodyPart(mbp2);

I really don't know what is the mbp2.setHeader("Content-ID","<23abc@pc27>"); stands for.

does anyone have any idea?
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Content-ID is important thing helping HTML renderer to find your attachment:

You should specify in message body for your logo <img src="cid:content_id"/>
content_id is value you set in Content-ID for your .jpg
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!