Add embeded image in email body

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

Add embeded image in email body
chen lu

Posts: 31
Joined: 2009-06-02
1, I try to add email image as follows

currentMailItem.Attachments.Add("C:\\pictest.jpg", Type.Missing, Type.Missing, "pictest.jpg");
int lastBodyMarker = currentMailItem.HTMLBody.ToUpper().LastIndexOf("</BODY>");
string sHtml = currentMailItem.HTMLBody.Substring(0, lastBodyMarker) + "<P>\n</P>" + "<img src=pictest.jpg/>\n" +"</BODY>\n" + "</HTML>";
currentMailItem.HTMLBody = sHtml;

I send this email to several recipients. recipients with Outlook and Gmail can see the image as embended image, but recipient in yahoo, cannot see the image.


2. So I think maybe I need use cid. The problem is Outlook.Attachment does not have propertyAccessor and ContentId, I cannot change the contentID. Is there any way to set contentID for outlook.Attachment and not use MAPI?
Posted 06 Oct, 2009 18:28:38 Top
Andrei Smolin

Add-in Express team

Posts: 17243
Joined: 2006-05-11
Hello Chen,

1. We don't know anything about how GMail and Yahoo process images, sorry. Maybe some forum reader will be able to help you.

2. Please see Redemption:, search for "Create an HTML message with an embedded image" at that page.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 07 Oct, 2009 04:17:14 Top