property Message.LastError as Long

Retrieves the last error occurred.

TypeDescription
Long A long expression that indicates the last error occurred.

Use the LastError to check whether the email message was successfully delivered. If the message failed, the LastError retrieves the last error code. If the message was successfully sent the LastError gets 0. Use the Error property to get the description for an error code.  If the Notifer property points to an EMail object then the Send method retrieves 0. In this case, 0 means that the control has started delivering the message. Use EndSend event to check out if the message was delivered ok. If the Notifier property is set to nothing the Send method retrieves the last error code. 

The following samples show how to check whether a message was successfully sent:

Dim WithEvents e As EMail

Private Sub e_EndSend(ByVal Msg As EXEMAILLibCtl.IMessage)
    If (Msg.LastError = 0) Then
        MsgBox "The message was delivered OK."
    End If
    Debug.Print e.Error(Msg.LastError)
End Sub

Private Sub Form_Load()
    Set e = Runtime1.NewEMail()
    Dim m As Message
    Set m = Runtime1.NewMessage
    Set m.Notifier = e
    m.Send "me", "mike2@Unknown.com", "Test", "Hello world!"
End Sub

Private Sub Form_Load()
    Dim m As Message
    Set m = Runtime1.NewMessage
    If (0 = m.Send("me", "mike2@Unknown.com", "Test", "Hello world!")) Then
        MsgBox "The message was delivered OK."
    End If
End Sub