OnSendStart Event


Fired by SMTP object when it finished to send message envelope information (sender and recipients e-mail addresses) to the SMTP server and ready to submit the message itself.

Firing this event denotes that the mail server accepted the sender and recipients of the message. However, the server may still reject the message on the next stage due to too large size or inappropriate content of the message, etc.

This event can be fired by both Send and RelayMessage methods.


Parameters:  
ByRef Proceed As Boolean Default value is True, which tells MailBee to continue sending message data. 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.ImportBodyText "C:\docs\letter.htm", True
    objSMTP.Message.BodyEncoding = 2
    objSMTP.Send
    objSMTP.Disconnect
  End If
End Sub

Private Sub objSMTP_OnSendStart(Proceed As Boolean)
    Proceed = (MsgBox("Proceed with sending?", vbYesNo) = vbYes)
End Sub

See Also:

EnableEvents Property
OnMessageReady Event
OnSendProgress Event
OnSendComplete Event


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