Voici plusieurs exemples de messages de réaction par e-mail valides et non valides.
Offre valide pour la période multipart/alternative
Les réactions par e-mail se composent généralement de trois parties:
text/plain
: version en texte brut du message.text/vnd.google.email-reaction json
: partie de la réaction.text/html
: version HTML du message.
Exemple :
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--
Une seule partie du corps valide
Les réactions par e-mail peuvent également comporter une seule partie du corps, par exemple:
From: test [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}
Notez que Content-Transfer-Encoding
peut utiliser n'importe quel encodage standard:
From: test [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==
Pour les encodages binaires, tels que base64
, le fichier JSON doit être encodé au format UTF-8.
multipart/alternative
imbriqué valide dans multipart/related
Si la réaction concerne un message comportant des pièces jointes intégrées, il est possible de
générer un message avec une partie du corps multipart/related
contenant le
des pièces jointes et une partie multipart/alternative
, comme dans l'exemple précédent.
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--
Notez que la partie du corps de multipart/related
doit comporter d'autres champs, tels que
spécifiées par la RFC2387, mais qui ne sont pas pertinentes pour
déterminer si une réaction par e-mail est valide.)
Format JSON
non valide
La réaction suivante n'est pas valide, car il manque l'accolade fermante au fichier JSON:
From: test [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
La réaction suivante n'est pas valide, car le fichier JSON se termine par une virgule:
From: test [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,}
Champ version
non valide
La réaction suivante n'est pas valide, car il manque le champ version
:
From: test [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"}
La réaction suivante n'est pas valide, car le champ version
n'est pas 1
:
From: test [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}
Champ emoji
non valide
La réaction suivante n'est pas valide, car le champ emoji
est vide:
From: test [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}
La réaction suivante n'est pas valide, car le champ emoji
ne contient pas de
des emoji valides.
From: test [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}
La réaction suivante n'est pas valide, car l'emoji ❤ est manquant entre les deux caractères de jointure sans largeur (ZWJ). Notez que le caractère = à la fin de la première ligne de contenu représente un saut de ligne doux dans l'encodage.
From: test [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}