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 mailing lists <li...@mitm.nl> on 2006/05/12 15:13:58 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
Re: convertTo7Bit and Java bug ID 4403733
Posted by Stefano Bagnara <ap...@bago.org>.
You may also be interested in:
http://issues.apache.org/jira/browse/JAMES-52
and
http://archives.java.sun.com/cgi-bin/wa?A2=ind0605&L=javamail-interest&F=&S=&P=3478
PS: theoretically the bug 4403733 has been closed in Javamail 1.4 and
the setContent should not be needed anymore, but you can read in the
previous link that this is not totally true.
Stefano
mailing lists wrote:
> 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
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org