Disconnect Method


Disconnects from the IMAP4 server.

It is not necessary (though it's recommended) to call this method. The IMAP4 object automatically disconnects from the IMAP4 server when the object is to be freed.

Note: Unlike POP3, IMAP4 disconnection procedure does not expunges messages marked for deletion. To expunge messages, you must explicitly call Expunge or ExpungeAndClose method.


blnResult = ObjectName.Disconnect  
Parameters: None 
Return value As Boolean True if successful, False if disconnect procedure failed (was not connected, mail server is not responding). You can check ErrDesc property or log file to get more detailed error information  
Remarks: If this method fails, the connection will be aborted anyway. This means that Connected property will be always False after calling Disconnect method

Usage example:

Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.IMAP4")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.IMAP4")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then
  If Mailer.Disconnect Then
    MsgBox "Connection gracefully closed"
  Else
    MsgBox "Connection aborted"
  End If
End If

See Also:

Connect Method


Copyright © 2002-2022, AfterLogic Corporation. All rights reserved.