Notify External Recipient of Internal e-mail

Posted: March 2, 2010 in Exchange Server
Tags: , , , ,

N.B. This process will work with Exchange 2007 running on Windows 2008 & Exchange 2010 only.

You may have reason to send a notification to an external recipient informing them that they have received an e-mail in their internal mailbox.  Why would you want to? There could be a policy in place that prevents forwarding of e-mails or that prevents  the use of mobile devices and you want to alert mobile staff that they need to check their webmail.

To achieve this, you need to do the following:

  • Create a contact with the external email address
  • Create a transport rule that checks messages as they arrive to see if they are sent to the person you want to be notified.  If they are, raise an event in the event viewer.  (I also told the event to use the username of the user in case you wanted to do this for more than one person).
  • Create an on event trigger schedule to send an email to the internal address of the contact you created in step 1

Create contact

Using Exchange Management Console, navigate to User Configuration > Mail Contact and then from the action pane on the right hand side select New Mail Contact. This will start the wizard to create a new contact.

There are 2 options on the first screen.  The first is to create a new contact the second is to mail enable an existing Active Directory Contact.  For this example, we will use the New contact option. Click Next.

Complete the user details, selecting the Active Directory Organisational Unit if required.  Click the Edit button next to Extenal e-mail address and enter the external address you want the notifications to be sent to. Click Next.

The confirmation screen will confirm the information you entered in the previous screen, if you need to change the details click Back, otherwise Click New to create the contact.

Create the Transport Rule

A Transport Rule now needs to be created to raise an event when the Exchange Organisation delivers a message to the mailbox of the user you want notified.

Using Exchange Management Console, navigate to Organisation Configuration > Hub Transport and then from the action pane on the right hand side select New Transport Rule. This will start the wizard to create a new transport rule.

Enter a name for the rule. If you are likely to do this for more than one user then I would suggest entering the mailbox alias or username in the name so that it can be easily identified.  Click Next.

On the condition select the sent to people option in the top box then click the people link in the bottom box and select the internal mailbox you require the notifications for.  Click Next.

On the Actions screen in the top box select log an event with message then in the bottom screen click the message link and enter the message you will have created in the detail screen of the event viewer.  If you will be doing this for more than one user it is important this part is unique. Click Next.

On the Exception screen this is where you would add exceptions to the rule ranging from people sent from, to people/groups sent to.  If you need to add an exception then select one from the list and then click the link created in the bottom box. Click Next.

This screen provides final confirmation of the details entered.  Check the information and if it needs changing click Back and make the required modifications, otherwise  Click New to create the rule.

Create an Event Trigger

In Windows 2008 and Windows 2008 R2 we have the ability to create a scheduled task that runs on a trigger.  One of the triggers available is the On an event trigger.  This is triggered by an event being written to the event logs.

The first thing we need to do in this process is to have an event raised.  Now that the transport rule has been created, send an e-mail to the mailbox you have created the rule for.  This will trigger an event to be raised in the Application log.

Click Start > Administrative Tools > Event Viewer.  Navigate to Windows Logs and then Application log.  There should be an event with an Event ID of 4000 as illustrated below.

Right click on the event in the Application Log list and select Attach task to this event this will start the create task wizard.

Give your task a name and description.  If you will be performing this process for more than one user it is important that the name is unique to make it easy to identify later if you ever need to make changes. Click Next then Click Next on the Event Details page.

On the next screen, the From field must be a valid internal e-mail address (the mailbox doesn’t need to exist) and the To field is the internal e-mail address of the contact you created earlier.

The subject and text fields can be whatever you want them to be.  You also have the option of adding an attachment.  The SMTP Server is the IP address of the Exchange Server that has the Hub Transport role, in my example this was the local server so I have used the loopback address.  Click Next.

The final screen of the wizard is the confirmation of what you have entered on the previous screens.  If you need to make any changes, then press the Back button and make the required changes.

Before clicking Finish check the box that reads “Open the Properties dialog for this task when I click Finish” this will open the event for editing.  Click Finish

Once the task opens on the General tab you need to select the Run whether user is logged on or not.  This will allow the task to run even if no user is logged on to the console.  Select the Triggers tab.  Here you will see the On an Event trigger, highlight this and select properties.  On the following screen check the radio box for Custom and then click the New Event Filter button.

On the New Event Filter dialogue box select the XML tab and paste the code below.  This is where it is important when you created the transport rule to have something unique in the description so that it can be selected here.  This allows you to setup different events for different users.

  <Query Path="Application">
    <Select Path="Application">*[System[Provider[@Name='MSExchange Messaging Policies']]] and *[EventData[Data and (Data="jbloggs")]]</Select>

The majority of the text will stay exactly the same for each event you create for this procedure with the exception of this line: *[EventData[Data and (Data=”jbloggs”)]] this is searching for the text jbloggs in the details of the event log.

Once done click OK on this screen and then OK on the task screen.

This process with then notify an external contact of the receipt of an e-mail in an internal mailbox.

  1. BC says:

    Hi there, excellent article and information. I’ve followed your instruction set and I feel like I’m almost there but missing somthing. I’m wondering you can steer me in the right direction. The incoming email event shows up in the event viewer fine, however the task that the event is supposed to trigger will only work if I use the basic form rather than the Custom XML filter under “Custom Event Filter\Properties” I have noticed that I can run the XML filter manually from the task scheduler and it does work perfectly so my assumtion is that there’s something going on with the trigger, what I can’t tell what. Any ideas would be truly appreciated!
    The server is sbs 2008


    • BC says:

      ok, after a few more tries I’ve got it, in the example XML data: (Data=”jbloggs”)]] jbloggs was the entire text of the information in the Data secton rather than a search for that text, so if in my event it states “notice event to jbloggs” I put that entire stirng of text into the custom XML and bingo. working fine.

      • demazter says:

        Glad you got it resolved.
        I will double check the string information and post an update if required. Thanks for letting me know.

  2. Nitin Gupta says:


    Very nice, a few days back when I told someone to do this at EE, they laughed, but I had no time to explain, probably now I have some link to point them to 😉 !

    Gentleman, you are doing wonderfully well.


    • demazter says:

      Hi Nitin,
      yes I had been in a few threads myself where the final conclusion was that it couldn’t be done.

      I knew there must have been a way so I worked on it. And here it is 🙂

      it’s also on my EE article list.

  3. richard brown says:

    Thought i’d found the answer to my wishes on this one.

    But this is for the edge server isnt it?
    I have 2010 SP1 installed but do not have the option of ‘log to an event’ thought this might be a hidden option within powershell, but when using the LogEventText i get “A specified parameter isn’t valid on a server with the Hub Transport role installed”

    Unless i’ve got things very mixed up??

    • demazter says:

      This is done on the Hub Transport server, but as it says in my article, it will only work with Exchange 2007, for some reason the option has been removed in Exchange 2010.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s