cid URLs for email developers

Many HTML emails include logos, GIFs, and other types of images. While it is possible to host those assets publicly and reference them by their URLs in the source of HTML emails, this is not how it is commonly done. Instead, the image file content is wholly embedded into the email, separately from the HTML content, which is achieved by marking the email as multipart/related.

The body of a multipart/related email is split into multiple parts, one of which is the HTML source while the rest are the stretches of binary file content (one part for each binary file). Each part carrying a binary file can then be marked by a content-id which in turn can be used as a reference to this file in the HTML part of the email.

For example, if an email includes an image contained in a body part marked with Content-ID: <myimage>, the HTML body part can include the <img src="cid:myimage"> tag that displays the embedded image.

Related projects

Parse, inspect, and debug emails online.
email
How do multipart emails work?
email
Test your email server deployment.
SMTP, email
The difference between the email envelope and message headers when it comes to senders and recipients.
email
How to receive email in Node.js?
email, Node.js, JavaScript

Made by Anton Vasetenkov.

If you want to say hi, you can reach me on LinkedIn or via email. If you like my work, you can support me by buying me a coffee.