1

My Outlook signature contains an image. When replying to plain-text emails, Outlook creates a plain-text email where the image in the signature is not included.

Instead of changing the format to HTML and afterwards inserting the signature once again manually I created the following plugin:

private void replyEmpty_Click(object sender, RibbonControlEventArgs e)
{
    var mailItem = ((Inspector)e.Control.Context).CurrentItem;
    if (mailItem.BodyFormat != 2)
        mailItem.BodyFormat = OlBodyFormat.olFormatHTML;

    Microsoft.Office.Interop.Outlook.MailItem response = mailItem.Reply();
    response.Display();
    Marshal.ReleaseComObject(response);
}

The problem is that the mailItem.BodyFormat of the original message is set to HTML. Due to the change of the format, Outlook asks whether the changes should be saved:

"The properties of the message ABC have been changed. Do you want to save changes to this message?"

I want to avoid this extra click. So far, I couldn't find any alternative solutions. Any help is appreciated!

stm
  • 160
  • 1
  • 11

1 Answers1

1

Call MailItem.Close(OlInspectorClose.olDiscard).

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Thats it. Thanks a lot! – stm Sep 24 '15 at 21:16
  • Also keep in mind that you don't have to display the message if you don't want to - the signature is added when you display the item (that is what you do) or when to access the MailItem.GetIInspector property. – Dmitry Streblechenko Sep 24 '15 at 21:18