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.
Thanks for stopping by my digital playground! If you want to say hi, you can reach out to me on LinkedIn or via email. I'm always keen to chat and connect.
If you really-really like my work, you can support me by buying me a coffee.