Has Gmail set an invalid Content-ID header for embedded attachments?

Short version

The Content-ID header on the attachment must be of the form local-part "@" domain . Gmail content identifiers do not contain @ . Is this a real mistake, or am I reading the specification incorrectly?

Long version

I noticed this problem when I tried to send an email sent from Gmail with an embedded image attached. My mail (SwiftMailer) claimed that the Content-ID is invalid.

Here's the email I'm working with . I created this by inserting the image into a line in Gmail and sending it by email to myself.

Here are the relevant parts of the specification (as far as I can tell):

RFC 2045

 Content-ID Header Field In constructing a high-level user agent, it may be desirable to allow one body to make reference to another. Accordingly, bodies may be labelled using the "Content-ID" header field, which is syntactically identical to the "Message-ID" header field: id := "Content-ID" ":" msg-id 

RFC 822 here and here

 msg-id = "<" addr-spec ">" ; Unique message id addr-spec = local-part "@" domain ; global address 

What am I missing here? Isn't Gmail up to specification, or is it okay to have @ in Content-ID?

+4
source share
1 answer

Seeing no one send the best answer ...

My interpretation of RFC is right for you. I would say that Gmail does the wrong thing here, from the book. However, Gmail is indeed de facto valid by definition. Gmail is too popular for other software to not accept it, but it does everything that opens the door for more software to violate the specification in the same way until it becomes standard practice.

Unfortunately, this means that there is currently no exact specification that is true. Fortunately, this question now appears in Google results.


The original email in the question has disappeared, here is another example. This is only part of the encoded image of a multi-page message. Pay attention to the Content-ID header.

 --089e0153807e5a346d04f1ae7c38 Content-Type: image/gif; name="blank.gif" Content-Transfer-Encoding: base64 Content-ID: <ii_14403b4fa16783bf> X-Attachment-Id: ii_14403b4fa16783bf R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw== --089e0153807e5a346d04f1ae7c38-- 
+7
source

Source: https://habr.com/ru/post/1485124/


All Articles