0
I am using the code below and can insert an image into the body of the email. How would you add more images? Is it necessary to create multiple "imageCid"? The code below only shows the last image.
Microsoft.Office.Interop.Outlook.Attachment attachment = msg.Attachments.Add(@"D:\Users\chart.jpeg", OlAttachmentType.olEmbeddeditem, null, "Some image display name");
attachment = msg.Attachments.Add(@"D:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg", OlAttachmentType.olEmbeddeditem, null, "Some image display name");
attachment = msg.Attachments.Add(@"D:\Users\Public\Pictures\Sample Pictures\Hydrangeas.jpg", OlAttachmentType.olEmbeddeditem, null, "Some image display name");
attachment = msg.Attachments.Add(@"D:\Users\Public\Pictures\Sample Pictures\Penguins.jpg", OlAttachmentType.olEmbeddeditem, null, "Some image display name");
string imageCid1 = "image001.jpg@123";
string imageCid2 = "image002.jpg@123";
string imageCid3 = "image003.jpg@123";
string imageCid4 = "image004.jpg@123";
attachment.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", imageCid1);
attachment.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", imageCid2);
attachment.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", imageCid3);
attachment.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", imageCid4);
msg.HTMLBody = String.Format("<body><img src=\"cid:{0}\"><br/><img src=\"cid:{1}\"><br/><img src=\"cid:{2}\"><br/><img src=\"cid:{3}\"></body>", imageCid1, imageCid2, imageCid3, imageCid4);