【问题标题】:Building an AMP for Email with chilkat .net使用 chilkat .net 为电子邮件构建 AMP
【发布时间】: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


    【解决方案1】:

    这是一个适合我的例子:

    https://www.example-code.com/csharp/amp_for_email.asp

    它调用 AddPlainTextAlternativeBody 而不是设置 email.Body 属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-28
      • 2019-12-24
      • 2010-12-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多