EnableEvents Property
MailBee.SMTP object is capable of background
processing, so the program's user interface does not hang, and responds to Windows
events - this is called "Async mode".
Also, MailBee.SMTP object can fire events itself during long-run long-run
methods (Send and RelayMessage) - this is called "Event firing".
When events are turned on, you can abort current operation by calling SMTP.Abort
method (for example, in CommandClick sub of Cancel button) or by setting Proceed=False
in SMTP event handler (OnSendStart, OnSendProgress, etc).
By default events are turned off because their usage slightly reduces performance.
Set EnableEvents=True to enable events. You can then disable them
again by setting EnableEvents=False.
Order of firing SMTP events is as following:
Value Type: | Boolean | |
Parameters: | None | |
Remarks: | Events are useful in event-driven environments only (such as VB, VBA, Delphi, etc). ASP pages cannot handle events |
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.RelayMessage "C:\Data\email1.eml", "from@addr.com", "to@addr.com" objSMTP.Disconnect End If End Sub Private Sub objSMTP_OnSendProgress(ByVal TotalBytesSent As Long, Proceed As Boolean) MsgBox TotalBytesSent & " bytes sent" End Sub
See Also:
Abort Method
EnableEvents Property
OnMessageReady Event
OnSendStart Event
OnSendProgress Event
OnSendComplete Event
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.