MailLogoff Method

Closes an established MAPI mail session.

Syntax

expression**.MailLogoff**

*expression   *     Optional. An expression that returns an Application object.

Example

The following example checks for an existing mail session and logs off it. If not logged on, the following example logs on, downloads any new mail, and then logs off.

Sub LogoffFromMail()

    If Not IsNull(MailSession) Then
        MsgBox "Logging off mail session: " & MailSession
        Application.MailLogoff
    Else
        MsgBox "Logging on to mail session now."
        Application.MailLogon DownloadNewMail:=True
        MsgBox "Logging off mail session: " & MailSession
        Application.MailLogoff
    End If
    
End Sub

Applies to | Application Object

See Also | MailLogon Method | MailRoutingSlip Method | MailSend Method | MailSendScheduleNote Method | MailSession Method | MailSystem Method