Asp.net sending html emails with MVC.Postal. Clients seeing raw html in the emails

421 Views Asked by At

We are trying to send html email via MVC postal nuget package. The problem is some clients are seeing raw html tags in the email. Sending the same email to gmail and a few other providers causes no issues. Any ideas?

We are following the simple conventions as per the docs.

Email.cshtml

@model InviteViewModel

To: @Model.Email
From: [email protected]
Subject: @Model.Subject
Views: Html

Email.Html.cshtml

@model InviteViewModel

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
bla blah......
</html>
1

There are 1 best solutions below

0
On

The Content-Type: text/html; charset=utf-8 of the *.Html.cshtml file must be at the topmost line of the file.

Email.Html.cshtml

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

@model InviteViewModel    

<html>
bla blah......
</html>