AMP-Email:显示动态电子邮件时出错(INTERNAL_ERROR)

问题描述 投票:0回答:1

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

附加信息:

  • SPF,DKIM和DMARC的配置正确,如果I从我的域发送电子邮件给某人。我的电子邮件服务提供商是google。
  • gmail客户端中的开发人员设置已打开:“始终允许来自该发件人:“。
  • 如果我从收件箱中以.eml下载此消息,并将其导入AMP操场在这里:INTERNAL_ERROR message它成功导入,没有验证错误。我的电子邮件完全按应有方式打开-作为AMP hello world消息。 https://playground.amp.dev/?runtime=amp4email
  • [我使用gmail API发送消息,并使用js-base64对其进行编码:

    const gmail = google.gmail({version:'v1',auth:oauth2Client});

    My .eml imported to AMP playground

以下代码中提供的消息本身(来自上面代码的电子邮件变量)。 exampleBody看起来很丑,我试图使用mimemessage npm包以及相同的INTERNAL_ERROR来生成它。这只是AMP电子邮件文档“原样”的示例: const base64EncodedEmail = Base64.encodeURI(email); const status = gmail.users.messages .send({ userId: mail_config.ADDRESS, uploadType: 'multipart', resource: { raw: base64EncodedEmail } })

https://amp.dev/documentation/guides-and-tutorials/learn/email-spec/amp-email-structure/

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

gmail-api amp-html amp-email
1个回答
0
投票

如果您尚未 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上测试AMP,您可以使用registered with Google,它将动态电子邮件发送到您的gmail收件箱。


参考:

© www.soinside.com 2019 - 2024. All rights reserved.