简体   繁体   中英

Building an AMP for Email with chilkat .net

I would like to build an Email with Chilkat in .NET which would have three body contents: a HTML one, a plain text one and an AMP for Email one (with Content Type: "text/x-amp-html")

Current version on Chilkat (9.5.0.78) or the one I am using (9.5.0.68) doesn't support AMP for Email so it is not possible to build an email with the methods they provided. As a workaround I am editing the email via GetMime() which already has a Plain Body and Html Body and I am pasting the AMP part there.

Will Chilkat support AMP for Email?

EDIT:

With some more experiments I managed to make three bodies of a message although it's kind of ridicules:

var email = new Email();
email.Body = PlainContent;
email.AddHtmlAlternativeBody(HtmlContent);
email.RemoveHtmlAlternative();
email.SetTextBody(AmpHtmlContent, "text/x-amp-html");
email.AddHtmlAlternativeBody(HtmlContent);

The result is something like this:

    [...]

    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--

Here is an example that works for me:

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

It calls AddPlainTextAlternativeBody instead of setting the email.Body property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM