views:

381

answers:

2

Hey.

I have the following problem: my email client, using Javamail, can get all the parts of the emails just like sentdate, subject, from, to etc., but I cannot figure it out how to get the body of the message.

I already tried getContent() function but it does not give me the required texts.

Any help will be great.

Thanks, Hectai

+1  A: 

It would help if you could post your code.

I don't know if this is what you are expecting, but "getContent()" doesn't necessarily return a String with the message in it.

Look at the JavaDocs here - it returns an Object.

This might be a String, or a Multipart, or it might be an InputStream. It all depends upon the email message.

I'd suggest trying to print out the type of the Object that getContent() is returning.

Also, please have a read through the docs.

A_M
+1  A: 

You find a comprehensive introduction how to use the API here Fundamentals of the JavaMail API which provides many examples as code snippets.

stacker