Embedding Local Images for Email Clients
It is a very common need for developers to use this control to build an Email Message Composer application. We thought about your need and added a very good support in this control for such kind of need. A simple method call will embed all the local images and return .NET MailMessage Object. Just think about it, you do not have to go thru any complicated code writing steps at all. Once you get the MailMessage Object, you can decorate this object with your From Address, To Address, Subject and then, pass this object to your SMTP client. Just simple and clean.
1. Insert a local image from your computer:

2. Send an email message containing embedded images using Content.GetEmailMessageWithLocalImagesEmbedded() method:
C#
private void Button_Click(object sender, RoutedEventArgs e)
{
MailMessage mailMessage = wpfHtmlEditor1.Content.GetEmailMessageWithLocalImagesEmbedded();
mailMessage.To.Add(new MailAddress("toaddress@outlook.com", "Test Man"));
mailMessage.From = new MailAddress("fromaddress@gmail.com", "Sender Man");
// if you want to add additional attachmens
// mail.Attachments.Add(new Attachment("......"));
try
{
SmtpClient mySmtpClient = new SmtpClient("smtp.gmail.com", 587)
{
Credentials = new NetworkCredential("fromaddress@gmail.com", "<password>"),
EnableSsl = true
};
mySmtpClient.Send(mailMessage);
MessageBox.Show("sent");
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
}VBPrivate Sub Button_Click(sender As Object, e As RoutedEventArgs)
Dim mailMessage As MailMessage = wpfHtmlEditor1.Content.GetEmailMessageWithLocalImagesEmbedded()
mailMessage.[To].Add(New MailAddress("toaddress@outlook.com", "Test Man"))
mailMessage.From = New MailAddress("fromaddress@gmail.com", "Sender Man")
' if you want to add additional attachmens
' mail.Attachments.Add(new Attachment("......"));
Try
Dim mySmtpClient As New SmtpClient("smtp.gmail.com", 587) With { _
Key .Credentials = New NetworkCredential("fromaddress@gmail.com", "<password>"), _
Key .EnableSsl = True _
}
mySmtpClient.Send(mailMessage)
MessageBox.Show("sent")
Catch err As Exception
MessageBox.Show(err.Message)
End Try
End Sub3. Check your email:
What you actually get back: a fully assembled MailMessage with CID images
The Content.GetEmailMessageWithLocalImagesEmbedded() method does not just return a string — it returns a fully assembled System.Net.Mail.MailMessage with the editor body wired up as an AlternateView and every local image attached as a LinkedResource. Each <img src="C:\\..."> in the editor is rewritten to <img src="cid:<auto-generated>"> before the AlternateView is built, so the message renders inline images correctly in Outlook, Gmail, Apple Mail, Thunderbird, and every modern web mail client.
That is exactly the payload shape Microsoft documents for embedded images via SmtpClient — you do not have to hand-stitch the multipart/related structure yourself.
Decorating the returned MailMessage
Because the return value is a normal MailMessage, every standard property is available. A common production setup looks like this:
C#
var msg = wpfHtmlEditor1.Content.GetEmailMessageWithLocalImagesEmbedded(); msg.From = new System.Net.Mail.MailAddress("newsletter@example.com", "Example Newsletter"); msg.To.Add(new System.Net.Mail.MailAddress("customer@example.com")); msg.Subject = "Your weekly digest"; msg.Priority = System.Net.Mail.MailPriority.Normal; msg.Headers.Add("List-Unsubscribe", "<https://example.com/unsubscribe>"); // Optional: attach a non-image file (PDF, ZIP, etc.) on top of the inline images. msg.Attachments.Add(new System.Net.Mail.Attachment(@"C:\reports\digest.pdf")); using (var smtp = new System.Net.Mail.SmtpClient("smtp.example.com", 587) { EnableSsl = true, Credentials = new System.Net.NetworkCredential("newsletter@example.com", app_password) }) { smtp.Send(msg); } msg.Dispose(); // release the LinkedResource file streams

Choosing between CID embedding and Base64 data URIs
Both styles let the recipient see your images inline, but the trade-offs are different:
- CID / LinkedResource (this method): the right choice for SMTP email. Smaller wire size (no Base6