How can I read a message with Content-transfer-encoding header 8 bit using JavaMail 1.1.3?
Created May 4, 2012
Dieter Wimberger According to the API Specification, 8bit
is supported, because its part of the
RFC2045 specification.
The
The following code might help or at least give an idea:
The
MimeUtility.decode(java.io.InputStream is, java.lang.String encoding)
method should help you
to "read" parts of the message.The following code might help or at least give an idea:
//assume you have a MimeBodyPart mbp InputStream in=mbp.getInputStream(); String[] encoding=mbp.getHeader("Content-Transfer-Encoding"); if(encoding!=null && encoding.length>0){ in=MimeUtility.decode(in,encoding[0]); } //use the Stream in to read from...Note that it will retrieve the encoding from the header, so it should work for all supported encodings.