method Message.Send ([From as Variant], [To as Variant], [Subject as Variant], [Message as Variant], [Attachement as Variant])

Sends the email message to the recipients.

TypeDescription
From as Variant An  optional string expression that indicates the email address for the sender. If the parameter is missing, the control considers the From property been the sender's email address.
To as Variant An  optional string expression that indicates the recipients where the email message should be delivered. If the parameter is missing, the control considers the To property been the recipient email addresses. The list of recipients should be separated by commas.
Subject as Variant An  optional string expression that indicates the email message's subject. If the parameter is missing, the control considers the Subject property been the email message's subject.
Message as Variant An  optional string expression that indicates the email message's body as plain text. If the parameter is missing, the control considers the BodyText property being the email message's body text.
Attachement as Variant An  optional string expression that indicates the attachments of the email message. A String expression that indicates the files to attach as:
  • a list of files (including the full path) to attach, separated by semicolon
  • a multi-line string defining the file name to attach, with subsequent lines specifying the content of the file to attach (ability to attach a file with its content without physically having it)

If the parameter is missing, the control considers the Attachment property being the attachments for the message. To include attachments in your email message, there are two methods you can use:

  • Attachment property: Set the Attachment property of your email message object. This property allows you to specify the files you want to attach directly within your email composition process
  • Attachment argument of Send method: Alternatively, when calling the Send method to send your email, you can pass an Attachment argument. This argument lets you include files as attachments at the time of sending the email
ReturnDescription
LongA long expression that indicates the error's code. If the Notifier property points to an EMail object then value returned is 0

The Send method sends the email message to the To, Cc and Bcc recipients. To send an email message using blocking or non-blocking mode use Notifier property, before calling Send method. If the message's Notifer is set to nothing, the Send method retrieves the last error occurred. Use the Error property to get the description given the error code. If the Notifier property points to an EMail object the Send method retrieves 0, that means, that the control has started delivering the email message using non-blocking mode. Use the SendOnce property On True, to prevent overloading the mail server, when the message should be delivered to multiple recipients, so the message is sent only once, and the server is responsible for delivering the message to recipients.

The following sample shows how to send an email message 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", "mike2@Unknown2.com", "Test", "Hello world!"
End Sub

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

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