• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 472
Objective C Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
My previous laptop never exploded like that. Read this tiny ad while I sweep up the shards.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic