OnReceiveData Event
Fires when IMAP4 object receives new
chunk of data from the IMAP server.
If you need the actual data being received, not just its length, use GetLastReceivedDataChunk method.
| Parameters: | ||
| BytesReceived As Long | Received data chunk size in bytes | |
| 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 OnReceiveData event and print how many data bytes received Private Sub objIMAP4_OnReceiveData(ByVal BytesReceived As Long, Proceed As Boolean) Debug.Print BytesReceived & " bytes received"
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
OnAlert Event
OnStatusChange Event
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.