code: protected BodyPart handleBinaryPart(MimePart mediaPart, String contentType) throws IOException, MessagingException {
          String contentId = mediaPart.getContentID() != null ? "(" + mediaPart.getContentID() + ")" : "";
          return new BodyPart(mediaPart.getFileName() + contentId, contentType);
      }
docs: Construct simple body part from binary data just adding file name as content.
  @param mediaPart
  @param contentType
  @return
  @throws IOException