File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes Mail body coming with HTML tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Mail body coming with HTML tags" Watch "Mail body coming with HTML tags" New topic
Author

Mail body coming with HTML tags

SoumyaGh Ghosh
Greenhorn

Joined: Mar 02, 2013
Posts: 4
Hi,

I have a scenario of using java mail api as below:
I am reading Outlook/exchange server using java mail IMAP. The message bodies (including the cases which are of content type text/html) I am saving in local DB. But those contents are coming within <html> tags with all it's styles etc. These are nothing but the view source content of the mail bodies of outlook mails. I have to create one window for showing, replying the mails from my own application. So when I am showing those mail bodies within a text area from my jsp page, contents are showing with <html> tags, for that it's not possible to read the exact mail body contents. Also as there are features to reply or forward those mails, for that I need to provide text area support so that user can type further contents. Can anyone please suggest any idea how can I show only the mail bodies without html tags. Is there any option to provide html support for textarea contents? or I have to set specific content type at the type of mail reading from exchange server?
Pankaj Kr. Singh
Ranch Hand

Joined: Mar 31, 2011
Posts: 32

Hi SoumyaGh,

Use the MimeBodyPart and use the Input stream and read the message and save where ever you need to save

For example


Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mail body coming with HTML tags
 
Similar Threads
problem with images in web app
Problem viewing German umlauts in certain Outlook 20003
HTMLEditorKIT
JavaMail using Exchange
Javamail: Retrieve text/plain part of an multipart/alternative message?