LOGGER.info(String.format("Handdling attachment '%s', type: '%s'", filename, contentType));
}
else {
final String textFilename;
final ContentType ct;
try {
ct = new ContentType(contentType);
}
catch (ParseException e) {
throw new IllegalStateException("Error while parsing content type '" + contentType + "'.", e);
}
if ("text/plain".equalsIgnoreCase(ct.getBaseType())) {
textFilename = "message.txt";
}
else if ("text/html".equalsIgnoreCase(ct.getBaseType())) {
textFilename = "message.html";
}
else {
textFilename = "message.other";
}