OnAlert Event


Fires when there is an [ALERT] message in the IMAP4 server response.


Parameters:  
AlertText As String Alert message text  
ByRef Proceed As Boolean Default value is True, which tells MailBee to continue processing. You can set it to False to immediately abort IMAP4 session and disconnect from IMAP4 server  
Remarks: Events are turned off by default. To enable them, set EnableEvents to True

Usage example:

Option Explicit
' Early binding and "WithEvents" syntax required for handling MailBee's events
Dim WithEvents objIMAP4 As MailBee.IMAP4

Private Sub Command1_Click()
  Dim Envelopes As MailBee.Envelopes
  Set objIMAP4 = CreateObject("MailBee.IMAP4")
  objIMAP4.LicenseKey = "put your license key here"
  objIMAP4.EnableEvents = True ' Enable Async mode
  If objIMAP4.Connect("mailserver.com", 143, "MyName", "MyPassword") Then ' Long-run operation
    If objIMAP4.SelectMailbox("Inbox") Then ' Long-run operation
      Set Envelopes = objIMAP4.RetrieveEnvelopes(1, objIMAP4.MessageCount, False) ' Long-run operation
    End If
    objIMAP4.Disconnect ' Long-run operation
  End If
End Sub

' Respond to MailBee's OnAlert event
Private Sub objIMAP4_OnAlert(ByVal AlertText As String, Proceed As Boolean)
  MsgBox AlertText
End Sub Private Sub Form_Load() Set objIMAP4 = Nothing End Sub Private Sub Form_Unload(Cancel As Integer) If objIMAP4 Is Nothing Then Exit Sub If objIMAP4.Busy Then objIMAP4.Abort ' Cancel IMAP4 session on exit End Sub

See Also:

EnableEvents Property

OnReceiveData Event
OnStatusChange Event


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