code: private void convertLargeParts() {
  
          List<Attachment> newAttachments = new ArrayList<>();
  
          if (!publicParts.isEmpty()) {
              try {
  
                  List<Part> toLarge = new ArrayList<>();
                  for (Part p : publicParts) {
                      if (p.getData() != null && p.getData().length() > maxPartSize) {
                          String type = p.getType() != null ? p.getType() : "application/octet-stream";
                          newAttachments.add(Attachment.create(p.getData(), type, Attachment.LOCAL_AUTO_CONVERTED_FOLDER, p.getName()));
                          toLarge.add(p);
                          log.w("Message part " + p.getName() + " to large (" + p.getData().length() + ">" + maxPartSize + ") - converting to attachment.");
                      }
                  }
                  if (!toLarge.isEmpty()) {
                      publicParts.removeAll(toLarge);
                  }
  
              } catch (Exception e) {
                  log.f("Error when removing large message parts", e);
              }
          }
  
          attachments.addAll(newAttachments);
      }
docs: Convert message parts which data part exceed the limit of characters ({@link MessageProcessor#maxPartSize}) to content data.