About: SMTP Event Sinks

API Interface:  COM interfaces.

Business Logic: SMTP event sink interfaces which allow code to read and in cases modify a message during STMP transport

Language Support: Event interfaces can be implemented using managed (.NET) code or C++

Direct Property Access:  N/A

Product Versions: Windows Server 2000 and 2003

 

Summary:

An STMP event sink is code which run in process with a server's SMTP process and allows its used to access and modify a message during SMTP transport.  An SMTP event sink implements one or more event methods to process messages as they are flowing through the SMTP deliver process.  Messages can be cancelled or altered throughout various stages of the delivery process.  There are two types of events - protocol events and transport events.  Protocol events (OnInboundCommand, OnServerResponse, OnSessionStart, OnMessageStart, OnPerRecipient, OnBeforeData, and OnSessionEnd) are based on the SMTP protocol commands and transport events (OnTransportSubmission, OnPreCategorize, OnPostCategorize) are based on the message transport process.

Some Points Of Interest:

  • These event interfaces are available on Windows SMTP servers as well as Exchange 2000 and 2003 servers.  Exchange is not required to implement these events.
  • These events may fire for internal messages when an event sink is configured on an Exchange server however, the event sink will not be able to modify messages submitted by MAPI clients as Exchange merely provides a copy of the message to the event sink - modifying this copy will not modify the message in the store.
  • I your looking for working with a message in transport then look into Exchange Transport Agents, EWS Notification and DLP.

Backgrounders:

 

SMTP Server Events for Windows 2000
https://msdn.microsoft.com/en-us/library/ms528010(EXCHG.10).aspx

The Advanced Queuing Engine - TechNet provides a great run through of the delivery process and when the transport events fire...

https://technet.microsoft.com/library/bb124832(EXCHG.65).aspx

SMTP Protocol Events
https://msdn.microsoft.com/en-us/library/ms527700(EXCHG.10).aspx

SMTP Transport Events
https://msdn.microsoft.com/en-us/library/ms528086(EXCHG.10).aspx

You cannot modify MAPI messages that are trapped in an SMTP transport event sink
https://support.microsoft.com/en-us/kb/273233

Examples
https://msdn.microsoft.com/en-us/library/ms527721(EXCHG.10).aspx

Writing Managed Sinks for SMTP and Transport Events
https://www.microsoft.com/en-us/download/details.aspx?id=1295

Also see:

About: Messaging APIs
https://blogs.msdn.com/b/webdav_101/archive/2015/08/07/about-messaging-apis.aspx