Content and Message IDs

Message IDs (MIDs) and Content IDs (CIDs) are used to identify and refer to email messages and specific pieces of content within those messages. They are formally described in RFC 2392.

Message IDs

A Message ID (or MID) is used to refer to a specific message. MIDs are automatically assigned to messages and are required to be globally unique. In email headers an MID is provided as the Message-ID field and enclosed between angle brackets. For example, here’s a MID for a message sent from GMail:

Message-ID: <0a6c006d-ca8a-db1e-b470-8127627344d5@gmail.com>

The domain from which the message is send is often seen at the end of the MID. Here’s an MID for another message sent from the same GMail account.

Message-ID: <a7385435-772d-282d-d26c-ac3d9ad92470@gmail.com>

What about other services? Here are a couple of MIDs from messages sent via Amazon SES.

Message-ID: <01020186ad4630fd-bb0020fa-306e-4736-b6f6-0d83fcbb1145-000000@eu-west-1.amazonses.com>
Message-ID: <01020186a216773a-371fe2bc-e606-4d30-b1fd-873eff8e4b22-000000@eu-west-1.amazonses.com>

An MID header can be translated into an MID URL by (1) adding a mid: prefix and (2) URL-encoding. For example, the first MID above would translate to mid:0a6c006d-ca8a-db1e-b470-8127627344d5@gmail.com. An MID URL would be used to refer to another message. For example:

Please refer to the <a href="mid:0a6c006d-ca8a-db1e-b470-8127627344d5@gmail.com">other message</a>.

Content IDs

A Content ID (or CID) refers to a specific piece of content within a message. In email headers a CID is provided as the Content-ID field and enclosed between angle brackets.For example, the image in the MIME content below is assigned a CID of part1.KiAFGCfk.B0ColWzg@gmail.com.

Content-Type: image/gif; name="small-image.gif"
Content-Disposition: inline; filename="small-image.gif"
Content-Id: <part1.KiAFGCfk.B0ColWzg@gmail.com>
Content-Transfer-Encoding: base64

R0lGODlhAgACAMIEAKJkSbFyVKB9dnaInQAAAAAAAAAAAAAAACH+EUNyZWF0ZWQgd2l0aCBH
SU1QACH5BAEKAAQALAAAAAACAAIAAAMDGAKTADs=

A CID URL can be used to refer to the corresponding content from another part of the message. For example:

<img src="cid:part1.KiAFGCfk.B0ColWzg@gmail.com">

A CID is normally used to refer to other pieces of content within the same message. However, a CID can be combined with a MID to refer to content within another message. Note: When a MID and CID are combined, the result is still an MID. For example:

<img src="mid:0a6c006d-ca8a-db1e-b470-8127627344d5@gmail.com/part1.KiAFGCfk.B0ColWzg@gmail.com">