I use the JavaMail to receive emails in Android.
Problem is:
Message.getContent()
always return SharedByteArrayInputStream
.
And
Bodypart.getContent()
always return BASE64DecoderStream
or QRDecoderStream
.
I read the JavaMail'FAQ, it says:
Q: When reading a multipart message, why is the getContent method returning an IMAPInputStream (or SharedByteArrayInputStream)
instead of a MimeMultipart object?
A: This usually happens because the JavaBeans Activation Framework (JAF) can't find the mailcap configuration file included in the mail.jar file. JAF uses the thread's context class loader to look for the configuration file. If the context class loader is not set properly, this can fail. Most application servers should set the context class loader properly, but at least some versions of Tomcat do not. One workaround is to put the mail.jar file in Tomcat's lib directory instead of including it in the war file. Another workaround is to add code such as the following to the beginning of your application:
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
But i don't know how to fix this problem in Android. Is there anybody can help me?