SMTPSecureSocket.Messages

From Xojo Documentation

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

Supported for all project types and targets.

The queue of messages that are 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 add a message to the queue, use the Arrays.AddRow method. To remove a message, use the Arrays.RemoveRowAt method.

Sample Code

Send a simple email:

Var 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.AddRow(mail)
Socket1.SendMail