2

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: invites@domain.com
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>
StackThis
  • 1,262
  • 1
  • 14
  • 23

1 Answers1

1

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>
jflaga
  • 4,610
  • 2
  • 24
  • 20