Skip to content

Send


Overview

The Send method sends the mail item using the associated account's API.

Syntax

vba
MailItem.Send

Example

Example code snippet demonstrating how to use the Send method:

vba
' Create a new mail item
Dim MailerApp As New nlsMailer.Application
Dim mailItem As MailItem
Dim account As Account
Set account = MailerApp.Accounts.Add("John Doe", "john@example.com", , , olMailgun)
Set mailItem = MailerApp.CreateItem(olMailItem)

' Set mail item properties
mailItem.Subject = "Important Email"
mailItem.Body = "This is an important message."

' Add recipients
mailItem.Recipients.Add "recipient1@example.com"
mailItem.Recipients.Add "recipient2@example.com"

' Add an attachment
mailItem.Attachments.Add "C:\Documents\report.pdf"

' Send the email
mailItem.Send