Last modified: January 16, 2009

Applies to: Office 2010 | Outlook 2010 | Visual Studio

Defines a function that preprocesses message contents or the format of a message.

Header file:


Defined function implemented by:

Transport providers

Defined function called by:

MAPI spooler

HRESULT PreprocessMessage(
  LPVOID lpvSession,
  LPMESSAGE lpMessage,
  LPADRBOOK lpAdrBook,
  ULONG FAR * lpcOutbound,
  LPMESSAGE FAR * FAR * lpppMessage,
  LPADRLIST FAR * lppRecipList


[in] Pointer to the session to be used.


[in] Pointer to the message to be preprocessed.


[in] Pointer to the address book from which the user should select recipients for the message.


[in, out] Pointer to a folder. On input, the lpFolder parameter points to the folder that contains messages to be preprocessed. On output, lpFolder points to the folder where preprocessed messages have been placed.


[in] Pointer to the MAPIAllocateBuffer function, to be used to allocate memory.


[in] Pointer to the MAPIAllocateMore function, to be used to allocate additional memory where required.


[in] Pointer to the MAPIFreeBuffer function, to be used to free memory.


[out] Pointer to the number of messages in the array pointed to by the lpppMessage parameter.


[out] Pointer to a pointer to an array of pointers to preprocessed or otherwise generated messages.


[out] Pointer to an optional returned ADRLIST structure, listing preprocessor-detected recipients for which the message is undeliverable. For more information about the contents of this list, see the IMAPISupport::StatusRecips method.


Message contents were successfully preprocessed.

A transport-provider message preprocessor can present a progress indicator during message preprocessing. However, it should never present a dialog box requiring user interaction during message preprocessing.

When a preprocessor adds large amounts of data to an outbound message, certain procedures should be followed. This type of message can be stored in a server-based message store, causing the preprocessor to access a remote store, a time-consuming procedure. To avoid having to do so, the preprocessor should have an option that enables it to store data that takes a large amount of space in a local message store and to provide a reference to that local store in the message.

The preprocessor should not release any of the objects originally passed to the PreprocessMessage based function.

Before the MAPI spooler can call a PreprocessMessage function, the transport provider must have registered the function in a call to the IMAPISupport::RegisterPreprocessor method. After calling a PreprocessMessage function, the spooler cannot continue submitting a message until the function returns.

The MAPI spooler owns the task of submitting messages. This means the original message is never placed in an array of message pointers and that a call to the SubmitMessage methods is never required.