private void parseBodyParts(Multipart multipart, StringBuffer txtBody, StringBuffer htmlBody)
     throws IOException {
   for (BodyPart part : multipart.getBodyParts()) {
     if (part.isMimeType("text/plain")) {
       String txt = getTxtPart(part);
       txtBody.append(txt);
     } else if (part.isMimeType("text/html")) {
       String html = getTxtPart(part);
       htmlBody.append(html);
     }
     if (part.isMultipart()) {
       parseBodyParts((Multipart) part.getBody(), txtBody, htmlBody);
     }
   }
 }
  @Override
  protected InputPart extractPart(BodyPart bodyPart) throws IOException {
    InputPart currPart = super.extractPart(bodyPart);
    Field disposition = bodyPart.getHeader().getField(FieldName.CONTENT_DISPOSITION);
    if (disposition == null)
      throw new RuntimeException(Messages.MESSAGES.couldFindNoContentDispositionHeader());
    if (disposition instanceof ContentDispositionField) {
      String name = ((ContentDispositionField) disposition).getParameter("name");
      List<InputPart> list = formDataMap.get(name);
      if (list == null) {
        list = new LinkedList<InputPart>();
        formData.put(name, currPart);
        formDataMap.put(name, list);
      }
      list.add(currPart);
    } else {
      throw new RuntimeException(Messages.MESSAGES.couldNotParseContentDisposition(disposition));
    }

    return currPart;
  }