Search code examples
asp.net-mvc-5razorenginepostal

Asp.Net Postal MVC - The name 'Html' does not exist in the current context


I'm using asp.net Postal to send emails using a background job - Hangfire to be precise.

In my template I have the following code:

@Html.Raw(Model.Post.PostContent)

but i'm getting the following error:

 The name 'Html' does not exist in the current context

Below is the full template:

Views/Emails/Example.cshtml

@model ExampleEmail
To: @Model.To
From: @Model.From
Subject: @Model.Subject
Views: Text, Html

Views/Emails/Example.Html.cshtml

Content-Type: text/html; charset=utf-8

<html>
 <body>
    <p>@Html.Raw(Model.Post.PostContent)</p>
 </body>
</html>

How can I fix this?


Solution

  • Using @Raw(Model.Post.PostContent) seems to work