I am trying to generate emails with HTML content. this content has already gone through sanitation so I am not worried in that regard, however when I call:
Razor.Parse(template, model);
on the following Razor template:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body>
@(new System.Web.HtmlString(Model.EmailContent))
</body>
</html>
the email that is outputted is HTMl encoded, but I need it decoded. How can I accomplish this?
RazorEngine, like MVC’s Razor View Engine, will automatically encode values written to the template. To get around this, we’ve introduce an interface called
IEncodedString, with the default implementations beingHtmlEncodedStringandRawString.To use the latter, simply make a call to the inbuilt
Rawmethod ofTemplateBase: