Take the 2-minute tour ×  I have a byte array wich i wish to add
as an attachement to an email i am sending.  Unfortunally i
can't find how to attach it as a byte array, the solution i have
uses disk files (which i dont want since i dont want to write
the byte array just so i can attach it).  I've found one
solution that involves creating an object that extends
DataSource and use this as a wrapper for the byte array and then
feed that to the MimeBodyPart.  Anyone know of a better
solution?  share|improve this question  2 Answers 2  up vote 12
down vote accepted  Creating a DataSource is the right approach.
You don't have to write your own, though. Just use the
ByteArrayDataSource from JavaMail.  share|improve this answer
/facepalm i dont know why i didnt see that class, especially
considering i was trying to use the other solution and i wrote
the class down and named it : ByteArrayDatasource. =S –  Nuno
Furtado Nov 26 '09 at 17:45 @NunoFurtado Can you maybe update
your question with a code snippet that works?