Guest User

Untitled

a guest
Jul 16th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. byte[] attachmentData = ...;
  2. String attachmentContentType = ...;
  3. String attachmentFileName = ...;
  4.  
  5. MimeBodyPart attachmentPart = new MimeBodyPart();
  6. attachmentPart.setFileName(attachmentFileName);
  7. attachmentPart.setDisposition(Part.ATTACHMENT);
  8. DataSource src = new ByteArrayDataSource(attachmentData, attachmentContentType);
  9. DataHandler handler = new DataHandler(src);
  10. attachmentPart.setDataHandler(handler);
Add Comment
Please, Sign In to add comment