OnReceiveData Event


Fired by SMTP object after receving a new chunk of data from the server.


Parameters:  
BytesReceived As Long The size of the data chunk received at this time.  
ByRef Proceed As Boolean Default value is True, which tells MailBee to continue SMTP session. You can set it to False to immediately abort SMTP session and disconnect from SMTP server  
Remarks: Events are turned off by default. To enable them, set EnableEvents to True

Usage example:

Option Explicit
Dim WithEvents objSMTP As MailBee.SMTP

Private Sub Form_Load()
  Set objSMTP = New MailBee.SMTP
  objSMTP.LicenseKey = "put your license key here"
  objSMTP.EnableEvents = True
  objSMTP.ServerName = "mailserver.com"
  If objSMTP.Connect Then
    objSMTP.Message.ToAddr = "bill@yoursite.com"
    objSMTP.Message.FromAddr = "joe@mysite.com"
    objSMTP.Message.Subject = "Hello"
    objSMTP.Message.BodyText = "Body text"
    objSMTP.Send
    objSMTP.Disconnect
  End If
End Sub

Private Sub SMTP_OnReceiveData(ByVal BytesReceived As Long, Proceed As Boolean)
    Debug.Print "BytesReceived=" & BytesReceived
    Debug.Print "SMTP.GetLastDataFromServer=[" & SMTP.GetLastDataFromServer & "]"
End Sub

Private Sub SMTP_OnSendData(ByVal BytesSent As Long, Proceed As Boolean)
    Debug.Print "BytesSent=" & BytesSent
    Debug.Print "SMTP.GetLastDataFromClient=[" & SMTP.GetLastDataFromClient & "]"
End Sub

See Also:

EnableEvents Property
OnSendProgress Event


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