Yordan Borisov
Yordan Borisov

Reputation: 1652

Java Mail API read message body problem

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.

Upvotes: 2

Views: 2882

Answers (1)

Anantha Sharma
Anantha Sharma

Reputation: 10098

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

Upvotes: 1

Related Questions