Topic Path: Symbol Reference > Classes > TIdIMAP4 Class > TIdIMAP4 Methods > Connect Method
TIdIMAP4.Connect Method

Opens a connection and optionally logs in to to the IMAP server.

function Connect(
    const AAutoLogin: boolean = true
): Boolean; virtual; reintroduce;
Indicates if the Login method is called when connecting. 

Connect is an overridden procedure in TIdIMAP4 that opens the connection to the IMAP4 server. 

AAndLogin indicates if the Login method is called using values in the Username and Password properties when establishing the connection to the server. 

Connect sets the value in the ConnectionState property to csNonAuthenticated on entry to the method. When AAndLogin contains True, the value may also be updated after successful completion of the Login method. 

Connect calls the inherited Connect method when Connected indicates the IMAP4 session has not been previously established. If Connected returns True, the method is exited with no additional processing. 

Connect captures values in the LastCmdResult property following connecting to the server for use in GreetingBanner property. 

Connect will call the Login method when AAndLogin contains True. Additional lines of text returned by the IMAP server may be stored in the Capabilities property when SASL is used for authenticating the client connection in ancestor classes. 

The Login method may be called manually when additional IMAP4 commands are required after connection but prior to logging in, such as when issuing the Capability command. This also allows switching users on the same server without having to disconnect from the server.

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