HomeProjectsBlogContact
Made with ❤️ by Anton Vasetenkov
cid URLs for email developers
Nov 3, 2021

cid URLs for email developers

What are cid URLs and how are they interpreted by email clients?

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.

See also
SMTP Testing Tool
Test SMTP server communication using the email testing tool.
Receiving email with Node.js
How to receive email in Node.js?
MAIL FROM and RCPT TO vs. the To and From headers
The difference between the email envelope and message headers when it comes to senders and recipients.