You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by li...@mitm.nl on 2006/05/12 12:49:30 UTC
convertTo7Bit and Java bug ID 4403733
Hi,
It seems that convertTo7Bit is also plagued by Java bug 4403733 (see
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4403733). If a message is
multipart all individual parts are converted to 7bit. The problem though is
that because of bug 4403733 the changed parts are not persistent. A
possible workaround, taken from the bug report, is to add a setContent
private void convertTo7Bit(MimePart part) throws MessagingException,
IOException {
if (part.isMimeType("multipart/*")) {
MimeMultipart parts = (MimeMultipart) part.getContent();
int count = parts.getCount();
for (int i = 0; i < count; i++) {
convertTo7Bit((MimePart)parts.getBodyPart(i));
}
part.setContent(parts);
<============================================ setContent added
} else {
if (part.isMimeType("text/*")) {
part.setHeader("Content-Transfer-Encoding",
"quoted-printable");
part.addHeader("X-MIME-Autoconverted", "from 8bit to
quoted-printable by "+getMailetContext().getServerInfo());
} else {
// if the part doesn't contain text it will be base64
encoded.
part.setHeader("Content-Transfer-Encoding", "base64");
part.addHeader("X-MIME-Autoconverted", "from 8bit to base64
by "+getMailetContext().getServerInfo());
}
}
}
Is my observation correct?
Regards,
Martijn Brinkers