Question

I have a question about receiving emails from a smtp server. So I must get the messages from the server and get their body but I have a problem with this. I tried get the input stream of the message and read it all but it read really the all content of the message. So my question is : How to read a mail message body with Java mail api, the title part and the from part?

I search in google but with no success. I'm sorry if the question look stupid but I'm a beginer in Java Mail API.

Thanks in advance.

Was it helpful?

Solution

try this

you can read just the message body using the getContent method.

((MimeMessage)message).getContent();

this is an exceptionally well written resource on JavaMail API

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top