Insert embedded image in Outlook 2003

Add-in Express™ Support Service
That's what is more important than anything else

Insert embedded image in Outlook 2003
Image references local path, when inserting with HTMLBody 
Jacob Vestergaard


Guest


Hello,

I've been struggling for a bunch of hours with inserting an image in Outlook 2003.
In 2007 I can just modify the HTMLBody property of the MailItem with an <img src="C:\Img.jpg">, and then Outlook converts it to an embedded image.
Outlook 2003 does not behave this way unfortunately. It keeps the path to the local path, resulting in a red cross over the image for the receiver (unless he by accident has an image in the same path locally on his computer).

How should I go about solving this problem? If I could somehow use MAPI to add the image, and then reference it with it's Content-ID (cid), I think it would work. I have been looking at the MAPIStoreAccessor, but am stuck.

I really hope you have ideas - thanks in advance.
Posted 29 Aug, 2008 11:57:13 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Jacob.

Please read the following topic:
http://www.add-in-express.com/forum/read.php?FID=5&TID=2651&MID=12851&phrase_id=1010522#message12851

Do you use the same code to insert an image?
Posted 31 Aug, 2008 13:35:24 Top
Jacob Vestergaard


Guest


Hi Sergey,

Thank you for your response. It seems that the approach you suggest works in Outlook as well as Hotmail. However, when sending to my gmail account, the image is not displayed in the email - only as an attachment.

I don't know whether gmail is the only place with the "problem", which is why I would like to try another approach. Any ideas/insight?

It seems that the only difference between inserting an image using Insert-> Image in Outlook, and doing it the suggested way, is that the Content-ID is set in the MIME-header. I'm having trouble setting MAPI properties though using the adxMapiStoreAccessor. I believe it is because I am trying to set the MAPI properties either before, or in, the ItemSend event, which results in, that Outlook overrides them before the final sending of the mail. I can see this, if I set the MAPI properties in the send event, and set the e.Cancel = True - then the mail stays in the Drafts-folder with the correct properties set on the mail.
Posted 01 Sep, 2008 12:33:08 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Jacob.

Yes, Outlook changes the header after it sends the email. Now I don't have another solution for this issue. I will let you known if I find something reliable.
Posted 02 Sep, 2008 14:20:17 Top
Jacob Vestergaard


Guest


Hello again Sergey,

Maybe you can tell me this then: What kind of object can I get from the HTMLEditor property of the Inspector? When the EditorType is RTF I can get a ITextDocument using the GetTextEditor-function - and this type has a Paste method. So, what equivalent object can I get for the Htmleditor?

I would like to know this, so I can try a Clipboard.Paste-kind-of-approach with the HTML..

Thanks in advance.
Posted 03 Sep, 2008 17:23:40 Top
Eugene Astafiev


Guest


Hello Jacob,

You will get the IHTMLDocument interface from the HTMLEditor property of the Inspector.
Posted 09 Sep, 2008 06:11:00 Top