提示和已知限制
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
请遵循以下提示,确保您的 AMP 电子邮件在 Gmail 支持的所有平台和浏览器中均能正确且一致地呈现。
在收件箱中查看电子邮件时,主题行旁边显示的摘要文本(前标题)基于电子邮件的 text/html
或 text/plain
部分,而不会考虑 text/x-amp-html
部分。
Gmail 的搜索功能不会为电子邮件的动态部分编制索引。为帮助用户查找您的电子邮件,请在电子邮件的 text/html
或 text/plain
部分添加最重要的关键字。
系统会从电子邮件的 text/html
部分解析电子邮件标记和促销活动注释,并忽略 text/x-amp-html
部分中的标记和注释。
无论在 <form>
元素上设置的 enctype
属性的值如何,发送到端点的 amp-form
表单数据始终会编码为 application/x-www-form-urlencoded
。
由于动态电子邮件包含最新内容,因此用户可能会在同一会话中收到重复的电子邮件。例如,针对同一评论会话的电子邮件会话中的 Google 文档评论电子邮件在展开后都会看起来一样。Gmail 可以通过收起包含重复内容的电子邮件,防止在长会话中显示这些重复的电子邮件。为确保系统将电子邮件识别为重复内容,请将元标记 email.contentIds
添加到 AMP 标记中。
<head>
...
<meta name="email.contentIds" content="id1,id2,id3">
...
</head>
此元标记的内容应包含以英文逗号分隔的字符串列表,用于标识动态电子邮件中的唯一内容。如果会话中最后一封电子邮件的 Content ID 集是会话中所有其他电子邮件的 Content ID 集的(非严格)超集,则除最后一封电子邮件外,所有其他电子邮件都会相应地收起。
例如,包含以下内容 ID 集的电子邮件会话将会被收起:
包含以下内容 ID 集的电子邮件会话也会被收起:
- id1、id2
- id2、id3
- id1、id2、id3
如果电子邮件包含包含输入元素的表单,那么如果输入内容发生更改,用户可能会在离开电子邮件(而未提交表单)之前看到一条确认消息。在某些情况下,系统不会显示此确认消息,例如当用户清除表单或删除消息时。
amp-mustache
模板不能包含设置定界符的标记。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-25。
[null,null,["最后更新时间 (UTC):2025-03-25。"],[],[],null,["# Tips and known limitations\n\nFollow these tips to ensure your AMP emails render correctly and consistently\nacross all platforms and browsers that Gmail supports.\n| **Note:** This list is in addition to [AMP for Email best\n| practices](https://amp.dev/documentation/guides-and-tutorials/develop/amp_email_best_practices?format=email), which apply across multiple email providers.\n\n- The summary text displayed next to the subject line when viewing emails in\n your inbox (preheader) is based on the `text/html` or `text/plain` part of\n your email and doesn't take the `text/x-amp-html` part into account.\n\n- Gmail's search feature doesn't index the dynamic parts of the\n email. To help users find your emails, include the most important keywords\n in the `text/html` or `text/plain` part of the email.\n\n- [Email Markup](/workspace/gmail/markup) and [Promotions\n Annotations](/workspace/gmail/promotab) are parsed from the `text/html`\n part of the email and ignored in the `text/x-amp-html` part.\n\n- `amp-form` form data sent to your endpoint is always encoded as\n `application/x-www-form-urlencoded`, regardless of the value of the\n `enctype` attribute set on the `\u003cform\u003e` element.\n\n- Because dynamic emails contain up-to-date content, users might receive\n duplicate emails within the same thread. For example, the Google Docs\n commenting emails in one email thread for the same comment thread will all\n look identical when expanded. Gmail can prevent the display\n of these duplicate emails in long threads by collapsing emails with\n duplicate content. To ensure that emails are recognized as duplicates, add\n the meta tag `email.contentIds` to the AMP markup.\n\n \u003chead\u003e\n ...\n \u003cmeta name=\"email.contentIds\" content=\"id1,id2,id3\"\u003e\n ...\n \u003c/head\u003e\n\n The content of this meta tag should contain a comma separated list of\n strings identifying unique pieces of content within dynamic emails. If the\n content ID set of the last email in the thread is a (non-strict) superset of\n the content ID set of every other email in the thread, then all emails\n except the last one will be collapsed accordingly.\n\n For example, an email thread with the following content ID sets will be\n collapsed:\n - id1\n - id1\n - id1\n\n An email thread with the following content ID sets will also be collapsed:\n - id1, id2\n - id2, id3\n - id1, id2, id3\n- When the email contains a form with input elements, if the inputs are\n changed the user might see a confirmation before navigating away from the\n email without submitting the form. This confirmation isn't shown in some\n cases, such as if the user clears the form or upon message deletion.\n\n- `amp-mustache` templates can't contain set delimiter tags."]]