A client application logs on implicitly by using a 0 session handle when calling Simple MAPI functions. Not all of the Simple MAPI functions allow the session handle to be 0; these calls cannot be made outside of an established session. For example, the MAPIDeleteMail function can only delete a message from a pre-existing session; a 0 session handle causes MAPIDeleteMail to return an error value.
When the session handle is 0, Simple MAPI function calls use the flFlags parameter to determine how to create the temporary session. If flFlags is set to MAPI_NEW_SESSION, the call tries to establish a new session, either programmatically if possible or with a logon dialog box. If MAPI_NEW_SESSION is not set, the call tries to use the shared session. If the call cannot establish a temporary session or use the shared session, it will return an error value.
When the call completes, the state of the messaging system is as it was before the call was made. That is, the implicit session opened for the call is closed by the time the call returns.