Showing posts with label Byte Attachment. Show all posts
Showing posts with label Byte Attachment. Show all posts

Saturday, December 17, 2016

Send email with attachment which contains byte[] via java mail

Java Send Email Using Smtp Server


DataSource dataSource = new ByteArrayDataSource(bytes, "application/pdf");
MimeBodyPart pdfBodyPart = new MimeBodyPart();
pdfBodyPart.setDataHandler(new DataHandler(dataSource));
pdfBodyPart.setFileName("bankAdminReport.pdf");