JavaMail Read mail in as it is format

S

Sri

Hi all,

I want read the mail using javamail, I read the entire message but
format is disturbed.
Message reading as a normal text, How to read the message in HTML
( same as mail ) format?
 
M

Martin Gregorie

Hi all,

I want read the mail using javamail, I read the entire message but
format is disturbed.
Message reading as a normal text, How to read the message in HTML
( same as mail ) format?

"Normal text" in mail is not html. Plain text is the standard. The
only mail I receive that doesn't contain plain text is usually spam.

The HTML version of the text, if it is present, will be in a MIME
attachment with a content type of text/html. Extract its the contents and
use the appropriate class (HTMLEditorKit?) to display it.

You must also be prepared to handle messages that:
- contain only a plain text body (i.e. no MIME parts)
- contain MIME parts but no HTML text.
 
R

Roedy Green

I want read the mail using javamail, I read the entire message but
format is disturbed.
Message reading as a normal text, How to read the message in HTML
( same as mail ) format?

you might look at the code in http://mindprod.com/products1.html#BULK.

The trick is bits of code that use methods like this:

Part part = mp.getBodyPart( partIndex );
if ( !part.isMimeType( "text/plain" ) )
Multipart rmp = (Multipart) rm.getContent();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top