in mail-archive/server/src/main/java/org/apache/sling/mailarchiveserver/impl/MessageStoreImpl.java [209:226]
static void recursiveMultipartProcessing(Multipart multipart, StringBuilder plainBody, StringBuilder htmlBody, Boolean hasBody, List<BodyPart> attachments) throws IOException {
for (Entity enitiy : multipart.getBodyParts()) {
BodyPart part = (BodyPart) enitiy;
if (part.getDispositionType() != null && !part.getDispositionType().equals("")) {
// if DispositionType is null or empty, it means that it's multipart, not attached file
attachments.add(part);
} else {
if (part.isMimeType(PLAIN_MIMETYPE) && !hasBody) {
plainBody.append(getTextPart(part));
hasBody = true;
} else if (part.isMimeType(HTML_MIMETYPE) && !hasBody) {
htmlBody.append(getTextPart(part));
} else if (part.isMultipart()) {
recursiveMultipartProcessing((Multipart) part.getBody(), plainBody, htmlBody, hasBody, attachments);
}
}
}
}