aspNetEmail

EmbeddedObject.ContentID Property

The content id of the embedded object. The content id must be unique for all embedded objects.

public string ContentID {get; set;}

Example

            EmailMessage msg = new EmailMessage( "mail.mycompany.com");
            msg.FromAddress = "me@mycompany.com";
            msg.To = "you@yourcompany.com";
            msg.Subject="logo email";
            
            //add the html bodypart
            msg.HtmlBodyPart = "<b>What do you think of the cool new logo?</b><img src=cid:mylogo>";
            
            //embed and add the embedded object
            EmbeddedObject o = new EmbeddedObject();
            o.Name	= "logo.gif";
            o.ContentID = "mylogo";
            o.FilePath = "logo.gif";
            msg.EmbedObject( o );
            
            msg.Send();
            
            Dim msg As EmailMessage = New EmailMessage("mail.mycompany.com")
            msg.FromAddress = "me@mycompany.com"
            msg.To = "you@yourcompany.com"
            msg.Subject = "logo email"
            
            'add the html bodypart
            msg.HtmlBodyPart = "<b>What do you think of the cool new logo?</b><img src=cid:mylogo>"
            
            'embed and add the embedded object
            Dim o As EmbeddedObject = New EmbeddedObject()
            o.Name = "logo.gif"
            o.ContentID = "mylogo"
            o.FilePath = "logo.gif"
            msg.EmbedObject(o)
            
            msg.Send()
            

See Also

EmbeddedObject Class | aspNetEmail Namespace