I noticed that sometimes when I send a mail to a Gmail account. Gmail reject the message-id and regenerate the id.
You can identify this be by looking at the original message and seeing "SMTPIN_ADDED_BROKEN" string with in it.
For example:
<60f17262.1c69fb81.3e091.249dSMTPIN_ADDED_BROKEN@mx.google.com>
Then my original message-id added in the header "X-Google-Original-Message-ID"
As it makes it harder for me to track those messages at a later stage. I want to make sure in advance that all my message-id are valid. I guess that Google is validating the message-id against one of the RFC standards (probably https://datatracker.ietf.org/doc/html/rfc5322#section-3.6.4). Standards tend to be very wide and sometimes vague. Can someone provide more specific rules on how Google workspace validate message-ids.
Here is am example for message id that will be considered valid by the standard but rejected by Gmail
<CAFDdQNjt907n4M"kpM2zaXHA82ZCSppZOc+bYoeKuWkatrSbmw@mail.gmail.com>
=?UTF-8?Q?<762"51b6a8a859d4c2bd7ecd70a3aff811991d6b7@localhost.eu>?=
I guess gmail don't like the "
See also:
regex to validate a message-ID as per RFC2822
gmail is modifying header(Message-ID) of incoming mails
Update Following the answer from Rafa below. In rfc2822 you can find the following definition.
msg-id = [CFWS] "<" id-left "@" id-right ">" [CFWS]
id-left = dot-atom-text / no-fold-quote / obs-id-left
id-right = dot-atom-text / no-fold-literal / obs-id-right
no-fold-quote = DQUOTE *(qtext / quoted-pair) DQUOTE
Looking at DQUOTE for example if I follow the syntax correctly
DQUOTE - DQUOTE( ) finds the first double quote mark in the string and returns all characters from that point, until a second double quote mark is found. If the string does not contain at least two double quote marks, a null string is returned.
So the following should be a valid message id in RFC-2822
<test.a"rfc2822"c.123@message.com>
But it's rejected