HTMLMailer: Embedding Images Using Content IDs
HTMLMailer supports embedding images directly within HTML email messages using Content-ID (CID). This allows images to be displayed inline within the email body rather than as attachments.
By default, the ParseHTML property is set to true. When you assign HTML content to the MessageHTML property and include image tags, the component automatically generates the appropriate CID values and embeds the referenced images in the outgoing message.
If you need more control over how images are handled, you can disable automatic parsing by setting ParseHTML to false and manually add images to the component's Images collection.
Example:
htmlmailer1.ParseHTML = false;
htmlmailer1.MessageHTML = "<html><body><h1>hello</h1><img src='cid:1444'></img><h2>good bye</h2></body></html>";
HTMLImage myImage = new HTMLImage("testimage.bmp");
myImage.Id = "1444";
myImage.ImageType = "image/bmp";
htmlmailer1.Images.Add(myImage);
htmlmailer1.Send();
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.