أمثلة على التفاعل مع الرسائل الإلكترونية

في ما يلي عدّة نماذج لرسائل التفاعل مع البريد الإلكتروني الصالحة وغير الصالحة.

صالح في 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: text/vnd.google.email-reaction+json
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). تجدر الإشارة إلى أن الحرف = في نهاية سطر المحتوى الأول يمثل فاصل سطر سلس في الترميز Quald-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}