Outlook HTML Mail - changing linked items to embedded
I'm attempting to send HTML formatted emails using C# 3 via <code>Outlook.MailItem</code>

                Outlook.MailItem objMail = (Outlook.MailItem)olkApp.CreateItem(Outlook.OlItemType.olMailItem);
                objMail.To = to;
                objMail.Subject = subject;
                objMail.HTMLBody = htmlBody;

The email is generated externally by saving from an RTF control (TX Text Control), which yields HTML with links to images stored in a <<FileName>>_files subdirectory.

Sending the email this way generates a mail with broken links.  

Using Outlook 2007 as the email client with Word as the email editor, switching to RTF (Options tab, Format tab group) preserves the layout _and_ inlines the images.

Programatically doing this via:

            var oldFormat = objMail.BodyFormat;
            objMail.BodyFormat = Outlook.OlBodyFormat.olFormatRichText;
            objMail.BodyFormat = oldFormat;
loses the formatting and mangles the images (the image becomes a <code>[image]</code> link marker on screen which is clickable but no longer shows the image).  This isn't a surprise given that the documentation for [MailItem.BodyFormat Property](http://msdn.microsoft.com/en-us/library/bb207134.aspx) says "*All text formatting will be lost when the <code>BodyFormat</code> property is switched from RTF to HTML and vice-versa*".

Sadly there doesnt seem to be an easy way to change the <code>Type</code> of each <code>Attachment</code> in the <code>MailItem.Attachements</code> to <code>OlAttachmentType.olByValue</code>, as it's a read-only property that's set when you create the <code>Attachment</code>.

An approach that comes to mind is to walk the HTML, replacing the <code>`<img>`</code> tags with markers and programatically walking the <code>MailItem</code> text, inserting an <code>Outlook.Attachment</code> of <code>Type</code> <code>OlAttachmentType.olByValue</code>.

Another option is to convert the <code>`<img>`</code> links to use <code>`src="cid:uniqueIdN"`</code> and add the images as attachments with the referenced identities.

So, to the question... Is there a way to get the linked images converted to embedded images, ideally without getting into third party tools like Redemption?  Converting to RTF happens to yield the outcome, but doing it that way is by no means a pre-requisite, and obviously may lose fidelity - I Just Want It to Just Work :D  Neither of my existing ideas sound Clean to me.
Outlook HTML Mail - changing linked items to embedded
===

I'm attempting to send HTML formatted emails using C# 3 via <code>Outlook.MailItem</code>

                Outlook.MailItem objMail = (Outlook.MailItem)olkApp.CreateItem(Outlook.OlItemType.olMailItem);
                objMail.To = to;
                objMail.Subject = subject;
                objMail.HTMLBody = htmlBody;

The email is generated externally by saving from an RTF control (TX Text Control), which yields HTML with links to images stored in a <<FileName>>_files subdirectory.

Sending the email this way generates a mail with broken links.  

Using Outlook 2007 as the email client with Word as the email editor, switching to RTF (Options tab, Format tab group) preserves the layout _and_ inlines the images.

Programatically doing this via:

            var oldFormat = objMail.BodyFormat;
            objMail.BodyFormat = Outlook.OlBodyFormat.olFormatRichText;
            objMail.BodyFormat = oldFormat;
loses the formatting and mangles the images (the image becomes a <code>[image]</code> link marker on screen which is clickable but no longer shows the image).  This isn't a surprise given that the documentation for [MailItem.BodyFormat Property](http://msdn.microsoft.com/en-us/library/bb207134.aspx) says "*All text formatting will be lost when the <code>BodyFormat</code> property is switched from RTF to HTML and vice-versa*".

Sadly there doesnt seem to be an easy way to change the <code>Type</code> of each <code>Attachment</code> in the <code>MailItem.Attachements</code> to <code>OlAttachmentType.olByValue</code>, as it's a read-only property that's set when you create the <code>Attachment</code>.

An approach that comes to mind is to walk the HTML, replacing the <code>`<img>`</code> tags with markers and programatically walking the <code>MailItem</code> text, inserting an <code>Outlook.Attachment</code> of <code>Type</code> <code>OlAttachmentType.olByValue</code>.

Another option is to convert the <code>`<img>`</code> links to use <code>`src="cid:uniqueIdN"`</code> and add the images as attachments with the referenced identities.

So, to the question... Is there a way to get the linked images converted to embedded images, ideally without getting into third party tools like Redemption?  Converting to RTF happens to yield the outcome, but doing it that way is by no means a pre-requisite, and obviously may lose fidelity - I Just Want It to Just Work :D  Neither of my existing ideas sound Clean to me.