property Runtime.NewEMail as EMail

Creates and initializes a licensed EMail object at runtime.

TypeDescription
EMail An EMail object being created

Use the NewEMail property to create licensed EMail objects at runtime. If you deploy an application that uses CreateObject or New statements for creating new EMail objects, the application wont work on the machine where the ExEMail wasn't licensed. Instead, you have to use NewEmail and NewMessage properties to create licensed objects at runtime. 

The following sample shows how to send an email using blocking mode:

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

The following sample shows how to send an email using non-blocking way:

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", "mike1@Unknown2.com,mike2@Unknown2.com,mike3@Unknown2.com", "Hello"
End Sub