How do you get the file attachment size? I tried using multipart.getBodyPart(i).getSize(), but this returns -1.

Andrea Pompili

In this situation you can do this:

size = multipart.getBodyPart(i).
[Manager Note: This works perfectly for text (7-bit) attachments. In the case of binary attachments, they will be encoded so the stream size will be slightly larger.]