From Xojo Documentation
Connects to the mail server, sends the messages in the queue, and disconnects.
This method works asynchronously. So keep the reference to this SMTPSocket object alive while mail is sent: e.g. as a property of a window.
This example is the Action event of the Send button on the Send Mail Demo main window. It sends the new message after adding it to the array of messages.
// 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 = "firstname.lastname@example.org"
mail.Subject = "My Subject"
mail.BodyPlainText = "Hello!"
// send the email