SMTPSocket.Messages

From Xojo Documentation

Property (As EmailMessage() )
aSMTPSocket.Messages = newEmailMessage()Value
or
EmailMessage()Value = aSMTPSocket.Messages

Supported for all project types and targets.

The queue of messages that is waiting to be sent.

Notes

This is an array of which the 0th element is the next message to be sent. When a message is sent, it is removed from the queue and passed to the MessageSent event. To append a message to the queue, use the Append method. To remove a message, use the Remove method.

Sample Code

Send a simple email:

Dim mail As EmailMessage

// set up the socket
Socket1.Address = "smtp.myserver.com"
Socket1.Port = 25

Socket1.UserName = "<username>"
Socket1.Password = "<password>"

// populate the email message
mail = New EmailMessage
mail.FromAddress = "test@testsite.org"
mail.Subject = "My Subject"
mail.BodyPlainText = "Hello!"
mail.Headers.AppendHeader("X-Mailer","SMTP Test")

// send the email
Socket1.Messages.Append(mail)
Socket1.SendMail