以下是一些有效和无效的电子邮件回应消息示例。
有效期:multipart/alternative
电子邮件回应通常包含三个部分:
text/plain
:消息的纯文本版本。text/vnd.google.email-reaction+json
:回应部分。text/html
:消息的 HTML 版本。
示例如下:
From: test@google.com
Message-ID: <884457408.1.1697791227669@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: multipart/alternative;
boundary="----=_Part_0_2012232625.1697791227635"
------=_Part_0_2012232625.1697791227635
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Text body content
------=_Part_0_2012232625.1697791227635
Content-Type: text/vnd.google.email-reaction+json; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
{"emoji":"=F0=9F=99=83","version":1}
------=_Part_0_2012232625.1697791227635
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<h1>HTML body content</h1>
------=_Part_0_2012232625.1697791227635--
单个有效的身体部位
电子邮件回应也可以仅包含一个正文部分,例如:
From: test+no-reply@google.com
Message-ID: <940553268.0.1697791227697@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
{"emoji":"=F0=9F=99=83","version":1}
请注意,Content-Transfer-Encoding
可以是任何标准编码:
From: test+no-reply@google.com
Message-ID: <940553268.0.1697791227697@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: text/vnd.google.email-reaction+json
Content-Transfer-Encoding: base64
ewogICJlbW9qaSI6ICLwn46JIiwKICAidmVyc2lvbiI6IDEKfQ==
对于二进制编码(如 base64
),JSON 必须采用 UTF-8 编码。
multipart/related
中有效的嵌套 multipart/alternative
如果回应是对包含内嵌附件的邮件,则可以生成包含包含附件的 multipart/related
正文部分和 multipart/alternative
部分的消息,如前面的示例所示。
From: test@google.com
Message-ID: <913190639.2.1697793303663@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: multipart/related;
boundary="----=_Part_0_2012232625.1697793303618"
------=_Part_0_2012232625.1697793303618
Content-Type: multipart/alternative;
boundary="----=_Part_1_984213526.1697793303621"
------=_Part_1_984213526.1697793303621
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Text body content
------=_Part_1_984213526.1697793303621
Content-Type: text/vnd.google.email-reaction+json
Content-Transfer-Encoding: base64
ewogICJlbW9qaSI6ICLwn46JIiwKICAidmVyc2lvbiI6IDEKfQ==
------=_Part_1_984213526.1697793303621
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<h1>HTML body content</h1>
------=_Part_1_984213526.1697793303621--
------=_Part_0_2012232625.1697793303618
Content-Type: image/png
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="1x1.png"
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMA
QObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=
------=_Part_0_2012232625.1697793303618--
(请注意,multipart/related
正文部分应包含 RFC2387 中指定的其他字段,但这些字段与确定电子邮件回应是否有效无关。)
“JSON
”格式无效
以下回应无效,因为 JSON 缺少闭合大括号:
From: test+no-reply@google.com
Message-ID: <940553268.0.1697791227697@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
{"emoji":"=F0=9F=99=83","version":1
以下回应无效,因为 JSON 中包含尾随英文逗号:
From: test+no-reply@google.com
Message-ID: <940553268.0.1697791227697@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
{"emoji":"=F0=9F=99=83","version":1,}
version
字段无效
以下回应无效,因为它缺少 version
字段:
From: test+no-reply@google.com
Message-ID: <940553268.0.1697791227697@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
{"emoji":"=F0=9F=99=83"}
以下回应无效,因为 version
字段不是 1
:
From: test+no-reply@google.com
Message-ID: <940553268.0.1697791227697@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
{"emoji":"=F0=9F=99=83","version":2}
emoji
字段无效
以下回应无效,因为 emoji
字段为空:
From: test+no-reply@google.com
Message-ID: <940553268.0.1697791227697@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
{"emoji":"","version":1}
以下回应无效,因为 emoji
字段不包含有效的表情符号。
From: test+no-reply@google.com
Message-ID: <940553268.0.1697791227697@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
{"emoji":"A","version":1}
以下回应无效,因为两个零宽度连接符 (ZWJ) 字符之间缺少 ❤ 表情符号。请注意,第一个内容行的末尾的“=”字符表示 Quoted-Printable 编码中的软换行符。
From: test+no-reply@google.com
Message-ID: <940553268.0.1697791227697@mail.google.com>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <2938749223.1.39847234@mail.google.com>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
{"emoji":"=F0=9F=91=A9=F0=9F=8F=BC=E2=80=8D=E2=80=8D=F0=9F=91=A8=F0=9F=8F=BE",=
"version":1}