im having a problem to get the "text/calendar" part of an email.
Multipart mp = (Multipart) message.getContent();
String s = mp.getBodyPart(1).getContent().toString();
This code is returning "com.sun.mail.util.BASE64DecoderStream@44b07df8"
I read that I have to implement the read() method so I change my code:
Multipart mp = (Multipart) message.getContent();
BASE64DecoderStream base = (BASE64DecoderStream)mp.getBodyPart(1).getContent();
base.read();
But this is printing in console the following string :
"QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVRVUVTVA0KUFJPRElEOk1pY3Jvc29mdCBFeGNoYW5n
ZSBTZXJ2ZXIgMjAxMA0KVkVSU0lPTjoyLjANCkJFR0lOOlZUSU1FWk9ORQ0KVFpJRDpBcmdlbnRp
bmEgU3RhbmRhcmQgVGltZQ0KQkVHSU46U1RBTkRBUkQNCkRUU1RBUlQ6MTYwMTAxMDFUMDAwMDAw
DQpUWk9GRlNFVEZST006LTAzMDANClRaT0ZGU0VUVE86LTAzMDANCkVORDpTVEFOREFSRA0KQkVH
SU46REFZTElHSFQNCkRUU1RBUlQ6MTYwMTAxMDFUMDAwMDAwDQpUWk9GRlNFVEZST006LTAzMDAN
ClRaT0ZGU0VUVE86LTAzMDANCkVORDpEQVlMSUdIVA0KRU5EOlZ..."
Can someone help me and tell me what am i doing wrong please?
Finally, I realize that if I save as output stream in a file, i was able to read the content without any problems. Thanks a lot for the answer.