How to handle MailItem.Send event? RRS feed

  • Question

  • Hi all!  We have a function built into our help desk ticketing software to send emails with ticket details, but it sends plain text only.  I am creating an Outlook add-in to create a message with the ticket details filled in using nice looking HTML formatting.  I am using Outlook 2010 and Visual Studio 2010, programming in VB.

    I have pretty much everything working; the software will create a new message, populate the information and display it for the user to review/edit and then they press the Send button.  However, we have ticket groups to work, and I would like to handle the MailItem.Send event, so that when the user sends a message, the message for the next ticket is displayed.  If the user closes out of the message, then the loop is broken.

    I have searched for some time for a solution, but almost everything I see involves handling the Outlook.Application.ItemSend event.  I don't think this is the event I want to handle, because then this code will try to run for all Outlook items sent, rather than just the specfic MailItems my add-in is creating.  Does anyone have or know of any examples for using the MailItem.Send event?  Much thanks in advance for any assistance!

    Monday, April 9, 2012 3:50 PM


  • If it is your code that creates the mesage, you can mark a message in such a way that your Application.ItemSend event handler recognizes the message.

    You can either add a custom property using MailItem.UserProperties, or you can add a hidden text/tag in the HTML body.

    The drawback to using UserPorperties is that the message will be sent in the TNEF format (winmail.dat attachment).


    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!

    Monday, April 9, 2012 4:47 PM