我想在.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--
答案 0 :(得分:0)
以下是对我有用的示例:
https://www.example-code.com/csharp/amp_for_email.asp
它调用AddPlainTextAlternativeBody而不是设置email.Body属性。