Used to send secure email via the SMTP protocol using SSL or TLS encryption.
For use with SMTPConnectionMode property:
- ModeSTARTTLS = 0
- ModeSSLTLS = 1
The SMTPSecureSocket class is the same as the SMTPSocket class except that it is derived from SSLSocket instead of TCPSocket. As a result, you can use the Secure property of the SSLSocket class to provide secure communications.
If you use a constructor in a subclass of a SMTPSecureSocket, you must call the Super class's constructor in your subclass's constructor. The subclass will not work unless this is done.
In order to connect to Gmail you'll need to enable the "allow less secure apps" option as described in this Google support document:
With that enabled, these settings work for most users:
MailSocket.ConnectionType = SMTPSecureSocket.TLSv1
MailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
MailSocket.Secure = True
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