AttachmentContentID Property
Gets the Content-ID value of the attachment.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public string ContentID { get; }

Property Value

Type: String
A string containing the Content-ID (CID) value of the attachment, or an empty string if the attachment has no Content-ID.

Each attachment which is referenced in the message body (e.g. a picture in HTML body) usually has a Content-ID header which is used to reference this attachment from the message body.

For instance, if the HTML body contains <IMG SRC="cid:picture1">, it's expected there is an attached image with Content-ID picture1. This image must be displayed in place of <IMG SRC="cid:picture1"> tag when the HTML body is being rendered.

Note Note
MailBee.NET has special features for displaying HTML body with embedded pictures. See SaveHtmlAndRelatedFiles(String) and GetHtmlAndSaveRelatedFiles methods for more information.
This sample loads the message from .EML file and displays CIDs of each attachment.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// The actual code (put it into a method of your class)

// Load the message from file.
MailMessage msg = new MailMessage();

// For every attachment...
foreach (Attachment attach in msg.Attachments)    
    // the attachment identifier.
    Console.WriteLine("CID is " + attach.ContentID);
See Also