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");