I use aspose.words to get the text part of emails that do not have a textbody defined. I open HTMLBody with aspose.words and then save the document as text file. This works well in general but I experience some problems.
Find attached an email, take its htmlbody, open it in aspose.words as if it was an HTML file and then save the doc as text (I obtain the attached text file). As you can see, the tag appears but it should not.
Can you do something?
Another question please : look at how I encode (normalize) the HTMLbody to create a memorystream I will open with aspose.words. Is it the right way? And after, when I want to get the text back from the memorystream generated with Words, I use UTF8 encoding. Is it the right encoding?
Here is the code I use
MemoryStream ms = new MemoryStream();
UnicodeEncoding uniEncoding = new UnicodeEncoding();
byte html = uniEncoding.GetBytes(email.Message.HtmlBody.Normalize());
ms.Write(html, 0, html.Length);
LoadOptions lo = new LoadOptions();
Document doc = new Document(ms, lo);
MemoryStream msOut = new MemoryStream();
byte txt = msOut.ToArray();