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
solved their problem - but for me didn't.
Instead looking at samples and playing around I found out that
solved my problem where previously I used:
os = MimeUtility.decode(part.getInputStream(), "binary");
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.
enc = MimeUtility.getEncoding(part.getDataHandler());
os = MimeUtility.decode(part.getInputStream(), enc);