How can I read a message with Content-transfer-encoding header 8 bit using JavaMail 1.1.3?

Dieter Wimberger

According to the API Specification, 8bit is supported, because its part of the RFC2045 specification.
The MimeUtility.decode( 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){ 

//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.
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact