OnSendComplete Event


Fired by SMTP object when message sending is complete.

Firing this event denotes that SMTP server received all message data and returned response whether the message was accepted or not.

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


Parameters:  
Accepted As Boolean If True, SMTP server has accepted the message for delivery. False if the message was rejected (see SMTP.ErrDesc value for details)  
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_OnSendComplete(ByVal Accepted As Boolean)
    If Not Accepted Then MsgBox "The message was rejected by the server"
End Sub

See Also:

EnableEvents Property
OnMessageReady Event
OnSendStart Event
OnSendProgress Event


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