I got a javax.mail.Session named lSession, and a MimeMessage lMessage :
Session lSession = Session.getDefaultInstance(properties); MimeMessage lMessage = new
Try this code:
MimeBodyPart att = new MimeBodyPart(); ByteArrayDataSource bds = new ByteArrayDataSource(bytearray, "AttName"); att.setDataHandler(new DataHandler(bds)); att.setFileName(bds.getName());