Safe rendering of HtmlBody?

Hi all,

We would like to render the content of a HTML message that we have as a MailMessage object on a web application. What's the preferred way to do this in a safe way, so that i.e. JavaScripts are not run? Can the HtmlBody property of MailMessage safely be rendered to a web page? Are there any utility methods on the library to make the HTML safe?

Thanks,
Chris

Hi Chris,


MailMessage.HtmlBody property contains all the contents (Html + Javascript etc). And currently, there is no utility method to exclude the javascript contents from the Html body of the message.

I have logged it as a new feature request (ID: 18646) in our issue tracking system. We will look into it and will consider adding some feature to get safe Html. We will inform you when this feature becomes available. Sorry for the inconvenience.