none
Insert email signature when sending email in Outlook 2013 RRS feed

  • Question

  • I have two email signature styles, can I insert either one of the email signature when sending email based on keyword in subject?

    Or how to locate the position of current reply content in HTML email (exclude replies content)

    I used Visual Studio 2012 to develop the Outlook addin.

    Many thanks.

    Thursday, October 9, 2014 9:37 AM

Answers

  • Hello,

    You can use the ItemSend event of the Application class to make changes according to the keyword in the subject line. The event is fired whenever an Microsoft Outlook item is sent, either by the user through an Inspector (before the inspector is closed, but after the user clicks the Send button) or when the Send method for an Outlook item, such as MailItem, is used in a program. Note, the Cancel parameter passed to the event handler allows to prevent the item from sending. If the event handler procedure sets this argument to true, the send action is not completed and the inspector is left open.

    The Outlook object model doesn't provide any specific property for differentiating replies and body content. You need to treat it as a single string/HTML/Word document. You can use the following ways for altering the content of the Body:

    1. The Body property of the Outlook items.

    2. The HTMLBody property of Outlook items.

    3. The Word object model. The body is represented as a Word document. The WordEditor property of the Inspector class returns an instance of the Document class from the Word object model.

    All these ways are described in the Chapter 17: Working with Item Bodies in depth.

    • Marked as answer by _dson Wednesday, October 15, 2014 4:20 AM
    Thursday, October 9, 2014 9:46 AM

All replies

  • Hello,

    You can use the ItemSend event of the Application class to make changes according to the keyword in the subject line. The event is fired whenever an Microsoft Outlook item is sent, either by the user through an Inspector (before the inspector is closed, but after the user clicks the Send button) or when the Send method for an Outlook item, such as MailItem, is used in a program. Note, the Cancel parameter passed to the event handler allows to prevent the item from sending. If the event handler procedure sets this argument to true, the send action is not completed and the inspector is left open.

    The Outlook object model doesn't provide any specific property for differentiating replies and body content. You need to treat it as a single string/HTML/Word document. You can use the following ways for altering the content of the Body:

    1. The Body property of the Outlook items.

    2. The HTMLBody property of Outlook items.

    3. The Word object model. The body is represented as a Word document. The WordEditor property of the Inspector class returns an instance of the Document class from the Word object model.

    All these ways are described in the Chapter 17: Working with Item Bodies in depth.

    • Marked as answer by _dson Wednesday, October 15, 2014 4:20 AM
    Thursday, October 9, 2014 9:46 AM
  • Thanks for reply.

    But I not insert the signature before </body>. I would like to insert it at end of reply content. The </body> is end of all reply history. So, is there any possible HTML code to locate the position?

    Friday, October 10, 2014 8:36 AM
  • You need to parse the message body on your own.

    As I already wrote, the Outlook object model doesn't provide any specific property for differentiating replies and body content. You need to treat it as a single string/HTML/Word document.

    Friday, October 10, 2014 8:44 AM