From experience, Message.getContent() can return one of three things:
- a
String, this is then the plain text or HTML content of the email
- a Multipart instance
If it is the latter, you need to get its body parts. These also have a getContent() method, and I've seen the following return types of that method:
- String, again the plain text or HTML content
- InputStream, if the body part is an attachment
- Message, for other messages that are forwarded as attachments
- Multipart, you then get the contents of that again