A message store provider gets involved with the message sending process when a client calls the message's IMessage::SubmitMessage method. If multiple messages are to be sent, the message store must send them in the same order that the client used for its SubmitMessage calls.
The message store provider determines whether or not to involve the MAPI spooler. If the message store provider is not tightly coupled, the message requires preprocessing, or the tightly coupled store and transport cannot handle all of the recipients, the MAPI spooler must be involved.
The following procedure describes the tasks required of a message store provider for sending a message.
In IMessage::SubmitMessage, the message store provider| 1. Locks the message by calling IMsgStore::SetLockState. |
| 2. Performs the needed preprocessing by calling all of the preprocessing functions in the order of registration. Transport providers call IMAPISupport::RegisterPreprocessor to register preprocessing functions. |
| 3. Calls IMessage::SubmitMessage on the open message to indicate to the message store that preprocessing is complete. |
Note The following two steps will occur in the client process if there was no preprocessing and will occur when the MAPI spooler calls SubmitMessage if there was preprocessing.
| 1. Calls IMAPISupport::CompleteMsg if the message was preprocessed or the message store provider wants the MAPI spooler to complete message processing which is recommended so that messaging hooks can be invoked. Message flow continues with the MAPI spooler as described in the following procedure. |
| 2. Performs the following tasks if the message was not preprocessed or the message store provider does not want the MAPI spooler to complete message processing: |
| · Copies the message to the folder identified by the entry identifier in the PR_SENTMAIL_ENTRYID property, if set. |
| · Deletes the message if the PR_DELETE_AFTER_SUBMIT property has been set to TRUE. |
| · Unlocks the message if it is locked. |
| · Returns to the client. Message flow is complete. |
When a message is to be handled by the MAPI spooler, the message store provider sets the message's PR_SUBMIT_FLAGS property to SUBMITFLAG_LOCKED. The SUBMITFLAG_LOCKED flag indicates that the MAPI spooler has locked the message for its exclusive use. The other value for PR_SUBMIT_FLAGS, SUBMITFLAG_PREPROCESS, is set when the message requires preprocessing by one or more preprocessor functions registered by a transport provider.