Topic Path: Symbol Reference > Classes > TIdIMAP4 Class > TIdIMAP4 Methods > Disconnect Method > Disconnect Method (Boolean, Boolean)
TIdIMAP4.Disconnect Method (Boolean, Boolean)

Closes an IMAP4 session and connection.

procedure Disconnect(
    AImmediate: Boolean; 
    const ARaiseExceptionIfNotCon: Boolean
); overload; reintroduce;


Disconnect is an overloaded procedure in TIdIMAP4 that closes an IMAP4 session and connection. 

Disconnect requires that the session still be Connected in order to send the LOGOUT command. If Connected is False, an EIdNotConnected exception will be raised. This behavior is suppressed if the value in ARaiseExceptionIfNotCon is False. 

Disconnect calls the SendCmd method using the IMAP LOGOUT command prior to calling the inherited Disconnect method and setting ConnectionState to the value csNonAuthenticated. Please note that the contents of the Capabilities property are cleared in Disconnect. 

Disconnect is automatically called by the destructor when Connected contains True. 

Calling Disconnect with no arguments causes the session to be closed without notifying the peer connection and without raising an exception if the connection is already closed.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.