首页 > 解决方案 > AMP-Email:显示您的动态电子邮件时出错 (INTERNAL_ERROR)

问题描述

我正在尝试使用 gmail API 将我的第一封 AMP 电子邮件从我的 gmail 帐户发送给我自己(To === From)。我发送的消息与此处的 AMP 文档中提供的消息完全相同:https ://amp.dev/documentation/guides-and-tutorials/learn/email-spec/amp-email-structure/ ,包括所有 Content-Type 标头多部分/替代消息。但是,当我使用我的 chrome gmail 客户端收到此消息时,我只看到后备 HTML 版本和带有错误的横幅:“为什么没有呈现动态内容?显示您的动态电子邮件时出错(INTERNAL_ERROR)。更多信息”。INTERNAL_ERROR 消息

附加信息:

以下代码中提供的消息本身(来自上述代码的电子邮件变量)。exampleBody 看起来很丑,我尝试使用 mimemessage npm 包来生成它以及相同的 INTERNAL_ERROR。这只是 AMP 电子邮件文档“原样”中的示例:https ://amp.dev/documentation/guides-and-tutorials/learn/email-spec/amp-email-structure/

  const exampleBody = `Content-Type: multipart/alternative; boundary="001a114634ac3555ae05525685ae"

      --001a114634ac3555ae05525685ae
      Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes

      Hello World in plain text!

      --001a114634ac3555ae05525685ae
      Content-Type: text/x-amp-html; charset="UTF-8"

      <!doctype html>
      <html ⚡4email>
      <head>
        <meta charset="utf-8">
        <style amp4email-boilerplate>body{visibility:hidden}</style>
        <script async src="https://cdn.ampproject.org/v0.js"></script>
      </head>
      <body>
      Hello World in AMP!
      </body>
      </html>
      --001a114634ac3555ae05525685ae
      Content-Type: text/html; charset="UTF-8"

      <span>Hello World in HTML!</span>
      --001a114634ac3555ae05525685ae--`;

      const email =
        'From: ' +
        my_address +
        '\r\nTo: ' +
        my_address +
        '\r\nSubject: ' +
        subject +
        '\r\n' +
        exampleBody;

我在这里想念什么?请帮忙。

标签: gmail-apiamp-htmlamp-email

解决方案


如果您尚未向 Google 注册以发送动态电子邮件,您将无法这样做。

要在 Gmail 上测试 AMP,您可以使用Gmail AMP for Email playground,它将动态电子邮件发送到您的 gmail 收件箱。


参考:


推荐阅读