Platform SDK: SMTP Server Events |
[This is preliminary documentation and subject to change.]
The ISmtpInCommandSink::OnSmtpInCommand method is called on registered inbound protocol event sinks when an SMTP inbound command has been received.
HRESULT OnSmtpInCommand( [in] IUnknown *pServer, [in] IUnknown *pSession, [in] IMailMsgProperties *pMsg, [in] ISmtpInCommandContext *pContext );
Inbound protocol event sink COM classes expose this interface in order to receive notification that an inbound SMTP protocol command has been received by the protocol service. The type of notifications received by a particular sink is controlled using the Rule source binding property.
The first two arguments passed to the sink are references to objects that contain properties about the server and session respectively. Call QueryInterface to retrieve the IMailMsgPropertyBag interface on either object and use methods on this interface to access the server and session properties. Properties in the session object exist only for the lifetime of the SMTP protocol session.
The second argument is a reference to a MailMsg object. As message information is received from a transmitting client through the SMTP protocol, it is stored in the associated MailMsg object for the session. Sink objects use the IMailMsgProperties interface passed in the event method to interface with this MailMsg object. The information stored in the MailMsg object depends upon the list of received SMTP commands. For example, if the sink is notified of the "EHLO" SMTP protocol command, the MailMsg object will not contain recipient information or message content.
The fourth argument is a reference to an object containing context information about the SMTP connection, the SMTP command, the current SMTP status, and so one. Use methods on this interface to access this context information.