【问题标题】:Asp.net sending html emails with MVC.Postal. Clients seeing raw html in the emailsAsp.net 使用 MVC.Postal 发送 html 电子邮件。客户在电子邮件中看到原始 html
【发布时间】:2017-12-14 13:59:17
【问题描述】:

我们正在尝试通过 MVC 邮政 nuget 包发送 html 电子邮件。问题是一些客户在电子邮件中看到原始的 html 标签。向 gmail 和其他一些提供商发送相同的电子邮件不会导致任何问题。有什么想法吗?

我们遵循文档中的简单约定。

电子邮件.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>

【问题讨论】:

  • 我也遇到了这个问题,但是使用 Postal.AspNetCore,解决了吗?

标签: asp.net-mvc html-email postal


【解决方案1】:

*.Html.cshtml 文件的Content-Type: text/html; charset=utf-8 必须位于文件的最顶层。

Email.Html.cshtml

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

@model InviteViewModel    

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-19
    • 1970-01-01
    • 2013-09-08
    • 2011-03-30
    • 1970-01-01
    • 2012-08-27
    • 2015-06-07
    • 2022-01-13
    相关资源
    最近更新 更多