ตัวอย่างรีแอ็กชันทางอีเมล

ตัวอย่างข้อความรีแอ็กชันทางอีเมลที่ถูกต้องและไม่ถูกต้องมีดังนี้

multipart/alternative ที่ถูกต้อง

โดยปกติแล้ว รีแอ็กชันทางอีเมลจะมี 3 ส่วน ได้แก่

  • 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/alternative ที่ซ้อนกันใน multipart/related ซึ่งถูกต้อง

หากรีแอ็กชันเป็นข้อความที่มีไฟล์แนบแบบอินไลน์ คุณสามารถสร้างข้อความที่มีส่วนเนื้อหา 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 ควรมีฟิลด์อื่นๆ ที่ระบุโดย RFC 2387 แต่ไม่จำเป็นต้องใช้ฟิลด์เหล่านั้นเพื่อพิจารณาว่ารีแอ็กชันทาง อีเมลถูกต้องหรือไม่

รูปแบบ 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) 2 ตัว อักขระ = ที่ส่วนท้ายของบรรทัดเนื้อหาแรกแสดงถึงการขึ้นบรรทัดใหม่แบบยืดหยุ่นในการเข้ารหัสแบบ 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}