Last modified: July 23, 2011

Applies to: Outlook

Informs the transport provider that the MAPI spooler completed its processing on an outbound message.

HRESULT EndMessage(
  ULONG ulMsgRef,
  ULONG FAR * lpulFlags


[in] A message-specific reference value that was obtained in an earlier call to the IXPLogon::SubmitMessage method.


[out] A bitmask of flags that indicates to the MAPI spooler what it should do with the message. If no flags are set, the message has been sent. The following flags can be set:


The transport provider has all the information it needs about this message for now. When the transport provider requires more information or when it has sent the message, it notifies the MAPI spooler by calling the IMAPISupport::SpoolerNotify method with the NOTIFY_SENTDEFERRED flag and by passing the message's entry identifier.


The transport provider is not sending the message at the current time for reasons that are not error conditions. The transport provider should be called again later to send the message.


The transport provider needs to restart the message passed to it in an IMessage::SubmitMessage method call.


The call succeeded and returned the expected value or values.

The MAPI spooler calls the IXPLogon::EndMessage method after it completes the processing involved in providing extended delivery or nondelivery information.

Once this call returns, the value in the ulMsgRef parameter is no longer valid for this message. The transport provider can reuse the same value on a future message.

All objects that the transport provider opens during the transfer of a message should be released before the EndMessage call returns, with the exception of the message object that the MAPI spooler passes to the transport provider. The message object passed by the MAPI spooler is invalid after the EndMessage call.