I tried to extract attachments from a mime message and first I got errors like
"needed at least 2 valid base64 characters ... "
Searching the internet I found people having similar issues and setting
System.setProperty("mail.mime.base64.ignoreerrors", "true");
solved their problem - but for me didn't.
Instead looking at samples and playing around I found out that
os = MimeUtility.decode(part.getInputStream(), "binary");
solved my problem where previously I used:
enc = MimeUtility.getEncoding(part.getDataHandler());
os = MimeUtility.decode(part.getInputStream(), enc);
My question: According to decode method's javadoc I cannot see any logical reason or hint why I have to use "binary" and not the actual encoding of the content. So why the hell do I have to use "binary"? I don't understand that.