From Xojo Documentation
| This item was deprecated in version 2018r4.
Please use SMTPSecureSocket as a replacement.
Used to send email via the SMTP protocol. Use the EmailMessage class to create the email message to send.
The POP3Socket and SMTPSocket classes are used together to form the basis of an email client. POP3 is the standard internet protocol for receiving messages and SMTP (Simple Mail Transfer Protocol) is the standard internet protocol for sending emails.
SMTPSocket supports the 'login' authentication type as well as 'plain.' This increases the authentication compatibility with some servers.
If you use a constructor in a subclass of SMTPSocket, you must call the Super class's constructor in your subclass's constructor. The subclass will not work unless this is done.
Use SMTPSecureSocket to connect to Gmail.
To access an SMTP server from web apps running on Xojo Cloud, you will first have to use the FirewallPort class to open the port used to connect to the SMTP Server:
fwp.Open // This call is synchronous
If fwp.isOpen Then
// Do what you need to do
The following code assumes an SMTPSocket named SendMailSocket, has been added to the window.
SendMailSocket.Port = 25 // Check your server for the property port # to use
// Create the actual email message
Dim mail As New EmailMessage
mail.FromAddress = "firstname.lastname@example.org"
mail.Subject = "Test Email from Xojo"
mail.BodyPlainText = "Hello, World!"
mail.Headers.AppendHeader("X-Mailer", "Xojo SMTP Example") // Sample header
// Add the message to the SMTPSocket and send it
For complete examples that send and receive email, refer to these two projects that are included in the Xojo Examples:
- Examples/Communication/Internet/Email Example