Check .SentOnBehalfOf before sending mail

  • Hey guys, wondering if anybody can provide any help with an Outlook VBA task that I have.



    I'm using Outlook 2007 but need the code to work on 2010 also. What I want to acheive is code that runs when an email is sent. If it is sent from a specific shared mailbox I want to check the body of the email for a particular sentence. If it is true, send the item, if it is not true, I want to prompt the user with a msgbox saying "Are you sure you want to send it from this email address?"



    To give you an example of the code I have, I'll post it below. The issue with this code is that it displays the prompt no matter what the .sentOnBehalfOf Email Address is. I have this code pasted in 'ThisOutlookSession'