OnReceiveProgress Event


Fires when POP3 object receives new chunk of message/headers data.

This event can be fired multiple times (because each chunk has limited length, usually not more than 50-60KB, while the message being downloaded can be of many megabytes in size).


Parameters:  
Index As Long Index of the message being retrieved. Allowed range is: 1 <= Index <= POP3.MessageCount  
TotalBytesReceived As Long Total count of bytes already received for the current message  
ByRef Proceed As Boolean Default value is True, which tells MailBee to continue receiving message data. You can set it to False to immediately abort POP3 session and disconnect from POP3 server  
Remarks: Events are turned off by default. To enable them, set EnableEvents to True

Usage example:

Option Explicit
Dim WithEvents objPOP3 As MailBee.POP3

Private Sub Form_Load()
  Dim Msg As MailBee.Message
  Set objPOP3 = New MailBee.POP3
  objPOP3.LicenseKey = "put your license key here"
  objPOP3.EnableEvents = True
  If objPOP3.Connect ("mailserver.com", 110, "MyName", "MyPassword") Then
    If objPOP3.MessageCount > 0 Then
      Set Msg = objPOP3.RetrieveSingleMessage(1)
    End If
    objPOP3.Disconnect
  End If
End Sub

Private Sub objPOP3_OnReceiveProgress(ByVal Index As Long, ByVal TotalBytesReceived As Long, Proceed As Boolean)
  If TotalBytesReceived > 10000 Then Proceed = False ' Abort pop3 session if message data too large
End Sub

See Also:

EnableEvents Property
OnReceiveStart Event
OnReceiveComplete Event
OnMessageComplete Event


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