AMP

將 AMP 新增至現有電子郵件

AMP 電子郵件格式會以新的 MIME 部分嵌入。如果您的電子郵件傳送給支援 AMP 電子郵件的供應商,就會顯示電子郵件;如果沒有,也別擔心!供應商會顯示您的 HTML 或純文字備用內容。請按照本指南將 AMP 納入您的電子郵件中。

包含 AMP MIME 部分

電子郵件的結構為 MIME 樹狀結構,其中包含電子郵件訊息內文和任何附件。若要在電子郵件中加入 AMP,您需要新增一個 MIME 部分,並將內容類型設為 text/x-amp-html

AMP MIME 部分必須巢狀內嵌於 multipart/alternative 節點下,並與現有的 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 data-css-strict>
<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

部分電子郵件用戶端只會呈現最後一個 MIME 部分。為了確保電子郵件能順利呈現,請將 text/x-amp-html MIME 部分放在 text/html MIME 部分之前

當收件者轉寄或回覆 AMP 電子郵件時,會發生什麼事?

當使用者轉寄或回覆 AMP 電子郵件時,系統會移除 MIME 樹狀結構的 text/x-amp-html 部分。這就是為什麼即使將 AMP 電子郵件傳送給支援 MIME 類型的用戶端,在 HTML 部分中提供替代內容仍然很重要的原因。