Reading html mails

Dear experts,

I am attaching this snippet from one of my code that retrieve text

mail correctly but html however is not shown in presentable way.

I am listing this code where i actually print the content.

How can i get html in presentable manner.

<source>

DataHandler dh = mails.getDataHandler();

BufferedReader bin = new BufferedReader

(new InputStreamReader(dh.getInputStream()));

String line;

int lfd = 0;

while ((line = bin.readLine()) != null) {

out.write(line + "
");

}

</source>

[604 byte] By [Adi1000a] at [2007-10-2 21:52:30]
# 1

I guess that depends on what you mean by "presentable".

From your example it looks like you're generating output

to be included in a web page. The problem you're facing

is taking an arbitrary piece of html content (from your mail

message) and embedding it in another piece of html content

(the web page you're generating). At the extreme that's a

non-trivial problem, having nothing at all to do with JavaMail.

You probably need to consult an html expert.

BTW, I assume you've already figured out how to find the

text/html part in your message and extract its html content.

Also, you don't even need to use the DataHandler directly

in your application. You can use the Part.getInputStream

method directly.

bshannona at 2007-7-14 1:08:24 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...