في ما يلي عدة أمثلة على رسائل التفاعل الصالحة وغير الصالحة عبر البريد الإلكتروني.
سارٍ في الفترة 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/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). يمثّل الحرف = في نهاية السطر الأول من المحتوى فاصل أسطر ليّنًا في ترميز 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}