0

I'm trying to add an inline image to the HTML body. How do I edit the content disposition ID. Currently it takes it as normal attachment instead of emebdded attachment?

        string file = GetImageBytes();
        Redemption.Attachment att = mail.Attachments.Add(file, 1, null, "logo");
        att.Fields[0x3712001E] = "image.logo";
        mail.Commit();
        RDOMail msg = Globals.ThisAddIn.session.GetMessageFromID(mailItem.Item.EntryId);

        mail.Item.HTMLBody = CreateHTMLBody(msg, sender, nvd_sii, recipient);

I want add the above attachment as inline attachment. Is there any way I could do it using redemptions?

amrutha
  • 11
  • 2

1 Answers1

0

Instead of setting the content disposition property, I set PR_ATTACH_FLAGS "http://schemas.microsoft.com/mapi/proptag/0x37140003" to 4(for embedded image). This solved the issue. The code below worked

        string file = GetImageFile();
        Redemption.Attachment att = mail.Attachments.Add(file);
        att.Fields[0x3712001E] = "image.logo";
        att.Fields[0x37140003] = 4;
        mail.Commit();
        System.IO.File.Delete(file);
        RDOMail msg = Globals.ThisAddIn.session.GetMessageFromID(mailItem.Item.EntryId);


        mail.Item.HTMLBody = CreateHTMLBody(msg, sender, nvd_sii, recipient);
amrutha
  • 11
  • 2
  • You might also want to set the `PR_ATTACH_HIDDEN` to true on the attachment and SmartNoAttach (DASL name `http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8514000B`) on the message itself to true unless you also have real attachments. – Dmitry Streblechenko Feb 07 '21 at 04:25