One with developing code for messaging development is to have code run when a specific event happens. Each mailbox API has its own ways of handling calls. Below is an overview of APIs which support events on the mailbox.
Exchange Web Services (EWS):
Exchange Web Service notifications are widely used and has several models for notifications. Be sure to read-up on each notification methodology to find which is best for your application. Your code should be written to handle Exchange related throttling and the possible errors which might be thrown. When going against Exchange 2010, 2013 and Exchange Online its extremely important to write your code to support affinity.
Notification subscriptions, mailbox events, and EWS in Exchange
How to: Maintain affinity between a group of subscriptions and the Mailbox server in Exchange
Handling notification-related errors in EWS in Exchange
Mailbox synchronization and EWS in Exchange
EWS throttling in Exchange
REST for Exchange Online:
REST calls go directly against Exchange and the calls can be done from any client.
Outlook Notifications REST API reference (preview)
About: 365 REST APIs
Outlook Object Mode (OOM):
Outlook Object Model can be used in several ways. First, there is Outlook in-application VBA support which will handle events. Outlook is extensible through custom add-ins and such add-ins run code off of events. An external application can also be written to handle mailbox events. Note that OOM code needs to be run with an interactive user present. So, its not suitable for things such as windows and web services or web pages or any other form of non-user monitored automation.
Working with Outlook Events
Using Events with Automation
OOM can also handle Outlook application events:
Outlook Object Model Overview
With .NET code some extra care needs to be taken with Outlook Object model:
OOM.NET blog POSTS
Mail apps for Outlook
With Exchange Online there is a new type of development for customizing OWA called Mail apps for Outlook and it can run code upon some events.
Mail apps for Outlook
Extended MAPI Notifications:
Even though Extended MAPI is an extremely old messaging API it is still widely used today and it also does support code firing off of events. Note though that Extended MAPI must be written with unmanaged code such as C++.
Event Notification in MAPI
MAPI Notification Events
If you decide to go down the path of Extended MAPI then be sure to leverage this blog for information:
SGriffin’s MAPI Internals
Exchange Store Sinks
About: Exchange Store Sinks
About: Messaging APIs