How to convert outlook.mailitem HTML to normal HTML?

Prasad Gavande 1 Reputation point
2021-06-21T03:47:11.11+00:00

I am developing outlook add-in, in which I want to monitor emails. Once email is received I want to further work on it.
I am using simple function to read email body as below.

void items_itemAdd(object item)  
{      
            Outlook.MailItem mail = (Outlook.MailItem)item;      
            if (item != null)  
            {  
                    string mailBody = mail.HTMLBody.ToString();          
            }  
}  

but when I run the code, it return html body (mail.HTMLBody) with unwanted tags. (please see attachment, apologize, I was not able to post html code here)
107387-outlookgeneratedhtmlbody.png

I want to remove all unwanted tags, CSS.
How can I convert outlook generated html to normal html ?

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,557 questions
{count} votes