• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending a PDF Attachment via EMail

 
Mahesh Trikannad
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to send a PDF Attachment using Java mail.

I have the PDF as a byte array. I dont want to save it to a file, but want to create a attachment straight from the byte array.

How can I do that, using MimeMultiPart and MimeBodyPart

Mahesh
 
Piotr Maj
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, this is possible. All you need is to write a custom datasource. Look at the code below:


I hope this will be helpful.
 
Mahesh Trikannad
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Piotr,

I found another solution, where MimeBodyPart is extended , to provide functionality to set the content to a bytearray .

Guess there are different ways to do it, but none very obvious.

Mahesh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!