Sau đây là một số mẫu thông báo thể hiện cảm xúc đối với email hợp lệ và không hợp lệ.
multipart/alternative hợp lệ
Thông thường, thông báo thể hiện cảm xúc đối với email có 3 phần:
text/plain: phiên bản văn bản thuần tuý của thông báo.text/vnd.google.email-reaction+json: phần thể hiện cảm xúc.text/html: phiên bản HTML của thông báo.
Ví dụ:
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--
Một phần nội dung hợp lệ
Thông báo thể hiện cảm xúc đối với email cũng có thể chỉ có một phần nội dung như:
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}
Xin lưu ý rằng Content-Transfer-Encoding có thể là bất kỳ phương thức mã
hoá tiêu chuẩn nào:
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==
Đối với các phương thức mã hoá nhị phân, chẳng hạn như base64, JSON phải được mã hoá dưới dạng UTF-8.
multipart/alternative lồng nhau hợp lệ trong multipart/related
Nếu lượt thể hiện cảm xúc là đối với một thông báo có tệp đính kèm cùng dòng, thì bạn có thể tạo một thông báo có phần nội dung multipart/related chứa các tệp đính kèm cùng với phần multipart/alternative như ví dụ trước.
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--
(Xin lưu ý rằng phần nội dung multipart/related phải có các trường khác theo quy định của RFC2387, nhưng những trường đó không liên quan đến việc xác định xem thông báo thể hiện cảm xúc đối với email có hợp lệ hay không.)
Định dạng JSON không hợp lệ
Thông báo thể hiện cảm xúc sau đây không hợp lệ vì JSON thiếu dấu ngoặc nhọn đóng:
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
Thông báo thể hiện cảm xúc sau đây không hợp lệ vì JSON có dấu phẩy ở cuối dòng:
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,}
Trường version không hợp lệ
Thông báo thể hiện cảm xúc sau đây không hợp lệ vì thiếu trường
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"}
Thông báo thể hiện cảm xúc sau đây không hợp lệ vì trường version không
phải là 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}
Trường emoji không hợp lệ
Thông báo thể hiện cảm xúc sau đây không hợp lệ vì trường emoji trống:
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}
Thông báo thể hiện cảm xúc sau đây không hợp lệ vì trường emoji không
chứa biểu tượng cảm xúc hợp lệ.
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}
Thông báo thể hiện cảm xúc sau đây không hợp lệ vì thiếu biểu tượng cảm xúc ❤ giữa hai ký tự ZWJ (zero-width joiner – ký tự nối không có chiều rộng). Xin lưu ý rằng ký tự = ở cuối dòng nội dung đầu tiên biểu thị dấu ngắt dòng mềm trong phương thức mã hoá 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}