英文电子邮件显示类似中文的字符

时间:2013-04-18 05:15:48

标签: asp.net-mvc character-encoding postal

我正在使用Postal发送带有HTML和文字部分的电子邮件。

当电子邮件发送到Gmail时,它会正确显示。但是,当它显示在至少两个其他电子邮件系统(Mail Enable的webmail界面和客户端的未知系统)时,文本将呈现为类似于中文的内容。当客户端将电子邮件转发回Gmail帐户时,“中文”呈现也会显示。

生成的电子邮件示例:

X-Sender: no-reply@thecompany.com
X-Receiver: therecipient@thecompany.com
MIME-Version: 1.0
From: no-reply@thecompany.com
To: therecipient@thecompany.com
Date: 17 Apr 2013 22:11:25 -0700
Subject: Some Subject
Content-Type: multipart/alternative;
 boundary=--boundary_0_83808b99-ef32-4f47-8835-ba4a435a2141


----boundary_0_83808b99-ef32-4f47-8835-ba4a435a2141
Content-Type: text/plain; charset=utf-16
Content-Transfer-Encoding: base64

MIME ENCODED CONTENTS HERE==
----boundary_0_83808b99-ef32-4f47-8835-ba4a435a2141
Content-Type: text/html; charset=utf-16
Content-Transfer-Encoding: base64

MIME ENCODED CONTENTS HERE=
----boundary_0_83808b99-ef32-4f47-8835-ba4a435a2141--

显然有一个编码问题,Gmail以某种方式排除,但其他电子邮件服务器没有,但究竟是什么问题?

charset指定为utf-16。 Postal(或MVC引擎)实际上是否会生成utf-8输出?如何控制输出的编码和/或电子邮件标题中指定的charset

1 个答案:

答案 0 :(得分:2)

通过添加标题

,可以将字符编码显式设置为utf-8
Content-Type: text/plain; charset=utf-8
and
Content-Type: text/html; charset=utf-8

有关详细信息,请参阅此article

注意:文章中有一个拼写错误。 text/plain行缺少分号。这在上面的例子中得到了纠正。