property EMail.error (Code as Long) as String

Gets description for an error code.

TypeDescription
Code as Long A long expression that describes the error code
String A string expression that describes the error.

Use the Error property to get a description for an error code. Use the LastError property to get the last error occurred in delivering the message. If the Notifier property points to an EMail object, use the EndSend event to check the last error occured. The following sample shows how to check whether a message was successfully delivered, using non-blocking mode:

Dim WithEvents e As EMail

Private Sub e_EndSend(ByVal Msg As EXEMAILLibCtl.IMessage)
    If (Msg.LastError <> 0) Then
        Debug.Print 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 "m@malibu.com", "marfa@cool2.com", "Test", "The message has one attchament", "c:\winnt\system32\setup.exe"
End Sub

The following sample shows how to print the description for last error occurred using blocking mode ( when the Notifier property is set to nothing ). It's not recommended using blocking mode because it blocks your application while the message is delivered.

MsgBox Runtime1.NewEMail.Error(Runtime1.NewMessage().Send("m@malibu.com", "marfa@cool2.com", "Test", "The message has one attchament", "c:\winnt\system32\setup.exe"))

The following sample shows how to send an email message using a single line of code:

If 0 = Runtime1.NewMessage().Send("m@malibu.com", "marfa@cool2.com", "Test", "The message has one attchament", "c:\winnt\system32\setup.exe") Then
    MsgBox "OK"
End If