Interactions Between Hook Providers and the MAPI Spooler

The interactions between hook providers and the MAPI spooler are fairly simple:

  1. The MAPI spooler receives an inbound or outbound message from a message store or transport provider.
  2. The MAPI spooler calls the hook provider's InboundMsgHook or OutboundMsgHook method, whichever is appropriate.
  3. The hook provider processes the message, optionally returning a different destination folder for the message or returning values that cause the MAPI spooler to delete the message.
  4. The MAPI spooler calls any other hook providers — assuming that HOOK_CANCEL was not returned in step 3 — then delivers the message to its final destination or deletes it as appropriate.