Quantcast
Channel: SCN : Popular Discussions - Java Development
Viewing all articles
Browse latest Browse all 518

Sending PDF through mail - as INLINE item

$
0
0

Hi All,

 

     I have a requirement, wherein I have to send a PDF file through mail, as INLINE (i.e. displayed in the body of the message item),and not as ATTACHMENT.

     

     i.e. The PDF content should be seen in the body page of the mail itself.

 

   I tried this code, but no use. I am still getting the PDF file as ATTACHMENT itself.

 

MimeBodyPart mbp = new MimeBodyPart();
mbp.setDisposition(BodyPart.INLINE);
String datastr=new String(TvlAttachByteArr);
DataSource source = new ByteArrayDataSource(TvlAttachByteArr,"application/octet-stream");
mbp.setDataHandler(new DataHandler(source));
mbp.setFileName("TravelInline.pdf");
multipart.addBodyPart(mbp);

 

I tried this code for '.jpg' file also, but I am getting the image file as external attachment, and not as INLINE item.

 

Any one please help me to solve this....

 

Thanks,

Prabhakar.


Viewing all articles
Browse latest Browse all 518

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>