Fired after the control has done sending the message.
Type | Description | |||
Msg as Message | A Message object that contains the email message being sent to the SMTP server. |
The EndSend event is fired when sending the email message is done. The EndSend event is fired only if the Notifier property points to the EMail object. After the EndSend event was fired, the EMail object releases the Message object. The Message's count reference is increased by BeginSend event, and it is decreased by the EndSend event. In order to check whether the message was delivered OK you must handle the EndSend event. To check the latest error occurs use the LastError property. Use Error property to get the description for an error code. The following sample shows how to check whether the message was successfully delivered:
Dim WithEvents e As EMail
Private Sub e_Debug(ByVal Msg As EXEMAILLibCtl.IMessage, ByVal Description As String)
Debug.Print Description
End Sub
Private Sub e_EndSend(ByVal Msg As EXEMAILLibCtl.IMessage)
If (Msg.LastError = 0) Then
MsgBox "The message '" &
Msg.Subject & "' was was successfully delivered."
Else
MsgBox "The message '" &
Msg.Subject & "' failed. " & e.Error(Msg.LastError)
End If
End Sub
Private Sub Form_Load()
' Creates an EMail object, that will
receive Message notifications
Set e = Runtime1.NewEMail()
' Creates a Message object
Dim m As Message
Set m = Runtime1.NewMessage()
' Message' notifications are sent through
EMail object
Set m.Notifier = e
' Sends a message to one user
m.Send "me@malibu.com", "robingo@calcuta.fom",
"Test", "The message has one attchament",
"c:\winnt\system32\setup.exe"
End Sub