Java Mail

P

pravar

Hello

I have a mail program where while sending mail i am setting it to
msg.setDataHandler( new DataHandler( new ByteArrayDataSource(
email_msg , "text/html" ) )) is it possible to convert the email
message in "MIME Part: TEXT/PLAIN" format while reading . If it is
possible then which api should we use to convert.
 
R

Roedy Green

I have a mail program where while sending mail i am setting it to
msg.setDataHandler( new DataHandler( new ByteArrayDataSource(
email_msg , "text/html" ) )) is it possible to convert the email
message in "MIME Part: TEXT/PLAIN" format while reading . If it is
possible then which api should we use to convert.

you want to render the html as if you had a Lynx text browser.
see http://mindprod.com/jgloss/htmlrendering.html Perhaps someone has
done a simple text html renderer in Java. Possibly Lynx itself could
be co-erced into rendering for you and coughing up the results.

A very primitive version would just strip HTML tags.

See http://mindprod.com/quoter.html which has a strip HTML tags and a
convert HTML entities to chars function. You can cannibalise that
code. You could soup it up to recognize <p> and <hr> and replace with
NLs and you would have something that could do in a pinch.
 

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
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top