Index: C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/transport/mailets/AddFooter.java =================================================================== --- C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/transport/mailets/AddFooter.java (revision 365582) +++ C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/transport/mailets/AddFooter.java (working copy) @@ -17,6 +17,7 @@ package org.apache.james.transport.mailets; +import org.apache.james.util.io.IOUtil; import org.apache.mailet.GenericMailet; import org.apache.mailet.Mail; @@ -39,7 +40,7 @@ * This is the plain text version of the footer we are going to add */ String text = ""; - + /** * Initialize the mailet */ @@ -152,7 +153,7 @@ */ protected void addToText(MimePart part) throws MessagingException, IOException { // log("Trying to add footer to " + part.getContent().toString()); - String content = part.getContent().toString(); + String content = IOUtil.toString(part.getInputStream()); if (!content.endsWith("\n")) { content += "\r\n"; } @@ -171,7 +172,8 @@ */ protected void addToHTML(MimePart part) throws MessagingException, IOException { // log("Trying to add footer to " + part.getContent().toString()); - String content = part.getContent().toString(); + String content = IOUtil.toString(part.getInputStream()); + String contentType = part.getContentType(); /* This HTML part may have a closing tag. If so, we * want to insert out footer immediately prior to that tag. @@ -180,8 +182,10 @@ if (index == -1) index = content.lastIndexOf(""); String insert = "
" + getFooterHTML(); content = index == -1 ? content + insert : content.substring(0, index) + insert + content.substring(index); - - part.setContent(content, part.getContentType()); + + part.setText(content); + part.setHeader("Content-Type",contentType); + // log("After adding footer: " + part.getContent().toString()); }