expunge = Boolean.valueOf(properties.getProperty("expunge")).booleanValue();
}
private String getBody(javax.mail.Message message) throws Exception, MessagingException {
Part messagePart = message;
Object content = messagePart.getContent();
if (content instanceof Multipart) {
messagePart = ((Multipart) content).getBodyPart(0);
}
String contentType = messagePart.getContentType();
StringBuffer sb = new StringBuffer();
if (contentType.startsWith("text/plain") || contentType.startsWith("text/html")) {
InputStream is = messagePart.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String currentLine = reader.readLine();
while (currentLine != null) {
sb.append(currentLine);
sb.append('\n');
currentLine = reader.readLine();
}
}
if (content instanceof Multipart) {
int i = 1;
while (i < ((Multipart) content).getCount()) {
messagePart = ((Multipart) content).getBodyPart(i);
if (logger.isLoggable(BasicLevel.DEBUG)) {
logger.log(BasicLevel.DEBUG, "--- " + this + " Multipart : part=" + messagePart);
}
contentType = messagePart.getContentType();
if (contentType.startsWith("text/plain") || contentType.startsWith("text/html")) {
InputStream is = messagePart.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String currentLine = reader.readLine();
while (currentLine != null) {
sb.append(currentLine);