I would need to see the entire message to see if there really is a base64 encoding error.
What version of JavaMail are you using? There have been a few bugs in this area in older versions.
There is one serious error in your code, that may or may not be related to the error you're seeing. As described in the javadocs for the Part.getSize method, it may not return the exact size of the part. You should read the data from the InputStream until EOF. Or better yet, use the MimeBodyPart.saveFile method.