OnMessageReady Event


Fired by SMTP object after generating MIME-formatted message body.

This is the first event fired by Send and SendEx methods. RelayMessage method does not fire this event because raw body is not generated by this method.


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_OnMessageReady(Proceed As Boolean)
    Proceed = (MsgBox("Proceed with sending?", vbYesNo) = vbYes)
End Sub

See Also:

EnableEvents Property
OnSendStart Event
OnSendProgress Event
OnSendComplete Event


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