Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Multipart with both text/html and embedded images

843834Mar 9 2009 — edited Apr 9 2009
Is it possible to build a multi-part message with both text and html as well as images used within the html?

I can do a multi-part message with both text and html using Multiart mymultipart = new MimeMultipart("alternative") and then two body parts: first with setContent(xxx,"text/plain") and the second with setContent(yyy,"text/html").

I can embed images within my html by using Multiart mymultipart = new MimeMultipart("related") and then two body parts: first with setContent(xxx,"text/html") and then one or more body parts for the images with setContent(yyy,"image/jpg") and setHeader("Content-id","<imagename>") where "imagename" is referenced in the html as src="cid:imagename".

My question is whether or not it is possible to do both, i.e. first have a text version of the message, and then have an html version with related or embedded images?

Thanks,

ddsp.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2009
Added on Mar 9 2009
6 comments
1,163 views