Logoff Method (CDONTS Session Object)

The Logoff method uninitializes the Session object.

Syntax

objSession.Logoff( ) 
 

Remarks

The Logoff method terminates all activity on the Session object initialized by the LogonSMTP method. You can call LogonSMTP on the same Session object again. Attempted access to the Session object before initialization results in a return of CdoE_NOT_INITIALIZED.

Objects you create while you are active on a Session object become invalid when you call Logoff. You should Set your reference variables to Nothing for all such objects.

Example

This code fragment logs off from the messaging system:

' from the function Session_Logoff 
If Not objSession Is Nothing Then 
    objSession.Logoff 
    MsgBox "Logged off; reset global variables" 
Else 
    MsgBox "No active session; cannot log off" 
End If