Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- byte[] attachmentData = ...;
- String attachmentContentType = ...;
- String attachmentFileName = ...;
- MimeBodyPart attachmentPart = new MimeBodyPart();
- attachmentPart.setFileName(attachmentFileName);
- attachmentPart.setDisposition(Part.ATTACHMENT);
- DataSource src = new ByteArrayDataSource(attachmentData, attachmentContentType);
- DataHandler handler = new DataHandler(src);
- attachmentPart.setDataHandler(handler);
Add Comment
Please, Sign In to add comment