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

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

ใช้ได้ multipart/alternative

รีแอ็กชันอีเมลมักแบ่งออกเป็น 3 ส่วนดังนี้

  • text/plain: ข้อความในรูปแบบข้อความธรรมดา
  • text/vnd.google.email-reaction+json: ส่วนรีแอ็กชัน
  • text/html: ข้อความเวอร์ชัน HTML

เช่น

From: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
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: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
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: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
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: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
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: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
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: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
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: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

{"emoji":"=F0=9F=99=83"}

รีแอ็กชันต่อไปนี้ไม่ถูกต้องเนื่องจากช่อง version ไม่ใช่ 1:

From: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
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: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

{"emoji":"","version":1}

รีแอ็กชันต่อไปนี้ไม่ถูกต้องเนื่องจากช่อง emoji ไม่มี อีโมจิที่ถูกต้อง

From: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
Content-Type: text/vnd.google.email-reaction+json; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

{"emoji":"A","version":1}

รีแอ็กชันต่อไปนี้ไม่ถูกต้องเนื่องจากไม่มีอีโมจิ ❤ อยู่ระหว่าง อักขระการรวมเป็นศูนย์ (ZWJ) สองตัว โปรดทราบว่าอักขระ = ที่ท้าย บรรทัดเนื้อหาแรกแสดงการขึ้นบรรทัดใหม่ในข้อความ เครื่องหมายคำพูด-Printable การเข้ารหัส

From: [email protected]
Message-ID: <[email protected]>
Subject: subject
MIME-Version: 1.0
In-Reply-To: <[email protected]>
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}