【发布时间】:2019-05-30 22:46:01
【问题描述】:
我想在 .NET 中使用 Chilkat 构建一个电子邮件,其中包含三个正文内容:一个 HTML 内容、一个纯文本内容和一个用于电子邮件的 AMP(内容类型:“text/x-amp-html” )
Chilkat (9.5.0.78) 上的当前版本或我正在使用的版本 (9.5.0.68) 不支持 AMP for Email,因此无法使用他们提供的方法构建电子邮件。作为一种解决方法,我正在通过GetMime() 编辑电子邮件,该电子邮件已经具有普通正文和 Html 正文,并且我将 AMP 部分粘贴在那里。
Chilkat 是否支持 AMP for Email?
编辑:
通过更多的实验,我设法制作了一条消息的三个主体,尽管这有点嘲讽:
var email = new Email();
email.Body = PlainContent;
email.AddHtmlAlternativeBody(HtmlContent);
email.RemoveHtmlAlternative();
email.SetTextBody(AmpHtmlContent, "text/x-amp-html");
email.AddHtmlAlternativeBody(HtmlContent);
结果是这样的:
[...]
X-Message-Type: test
--------------090501080304020500060805
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
some text some text some text some text some text some text some text some =
text some text some text some text=20
--------------090501080304020500060805
Content-Type: text/x-amp-html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<!doctype html>
<html amp4email>
<head>
<meta charset=3D"utf-8">
<script async src=3D"https://cdn.ampproject.org/v0.js"></script>
<style amp4email-boilerplate>body{visibility:hidden}</style>
</head>
<body>
Hello, AMP world.
<amp-img src=3D"https://images-na.ssl-images-amazon.com/images/I/41zetwwV=
h3L.jpg" alt=3D"Welcome" width=3D"382" height=3D"500">
</amp-img>
</body>
</html>
--------------090501080304020500060805
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<html><head><META http-equiv=3D"Content-Type" content=3D"text/html;charset=
=3Dutf-8"></head><body><h1>test fallback to html</h1> <h1>test fallback t=
o html</h1> <h1>test fallback to html</h1> </body></html>
--------------090501080304020500060805--
【问题讨论】:
标签: chilkat