Abort Method


Aborts currently performed long-run operation and immediately disconnects from the POP3 server. If no long-run operation is currently performed, the method does nothing.

Long-run operation is any action which causes data exchange with the POP3 server. Connecting to the server, retrieving messages or headers, graceful disconnecting, etc. are all long-run operations.

To determine whether long-run operation is currently performing, examine Busy property value.

When long-run operation is aborted, rough disconnection procedure takes place (not graceful one) so "QUIT" POP3 command is not executed. This means that if there are some messages marked for deletion, they will NOT be deleted.

Once the connection is aborted, ErrCode property of POP3 object is set to value of 7 (Connection aborted by client side).

Note: Abort method can be called only if POP3.EnableEvents=True (Async mode is on). Calling Abort method does not immediately closes the connection, it just notifies POP3 object to close it. Closing itself occures after millisecond or so after calling Abort method. This is a specificity of Async mode operation.


blnResult = ObjectName.Abort  
Parameters: None 
Return value As Boolean True if successful, False if error has occurred (nothing to abort because there is no long-run operation in progress)  

Usage example:

Option Explicit
Dim objPOP3 As Object

Private Sub Command1_Click()
  Dim Msgs As Object
  Set objPOP3 = CreateObject("MailBee.POP3")
  objPOP3.LicenseKey = "put your license key here"
  objPOP3.EnableEvents = True ' Enable asynchronous mode
  If objPOP3.Connect("mailserver.com", 110, "MyName", "MyPassword") Then ' Long-run operation
    Set Msgs = objPOP3.RetrieveHeaders ' Long-run operation
    objPOP3.Disconnect ' Long-run operation
  End If
End Sub

Private Sub Form_Load()
    Set objPOP3 = Nothing
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If objPOP3 Is Nothing Then Exit Sub
    If objPOP3.Busy Then objPOP3.Abort ' Cancel POP3 session on exit
End Sub

See Also:

Busy Property
EnableEvents Property
ErrCode Property


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