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?
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.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.