AMP

AMP 電子郵件的結構與呈現方式

電子郵件的結構為 MIME 樹狀結構。此 MIME 樹狀結構包含郵件內文以及任何郵件附件。

若要在電子郵件中嵌入 AMP,請新增一個 MIME 部分,其內容類型為 text/x-amp-html,作為 multipart/alternative 的子系。它應與現有的 text/htmltext/plain 部分並存。這可確保電子郵件訊息在所有用戶端上都能運作。

如需關於 multipart/alternative 子類型的詳細資訊,請參閱 RFC 1521 第 7.2.3 節

其他資訊

text/x-amp-html 部分必須巢狀於 multipart/alternative 節點下。電子郵件在一個 multipart/alternative 節點內不能有多個 text/x-amp-html 部分。

除了 text/x-amp-html 節點外,multipart/alternative 必須至少包含一個非 AMP 節點 (text/plaintext/html)。這會顯示給電子郵件用戶端不支援 AMP 的使用者,或透過其電子郵件提供商設定選擇停用的使用者。

某些電子郵件用戶端[1]只會呈現最後一個 MIME 部分,因此我們建議將 text/x-amp-html MIME 部分放在 text/html MIME 部分之前

回覆/轉寄語意

當使用者回覆或轉寄 AMP 電子郵件訊息時,電子郵件用戶端會移除 MIME 樹狀結構的 text/x-amp-html 部分。

到期

電子郵件用戶端可能會在設定的一段時間 (例如 30 天) 後停止顯示電子郵件的 AMP 部分。在這種情況下,電子郵件將會顯示 text/htmltext/plain 部分。

範例

From:  Person A <persona@example.com>
To: Person B <personb@example.com>
Subject: An AMP email!
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--