SMTPSecureSocket: error 421 : 4.7.66 TLS 1.0 and 1.1 are not supported

Hi forum members,
I am trying to send emails from my web app using smtp.office365.com.
Sometimes, the mail is sent without an error. However, more often I get the following ServerErrorHandler error: "421 4.7.66 TLS 1.0 and 1.1 are not supported. Please upgrade/update your client to support TLS 1.2. Visit New opt-in endpoint available for SMTP AUTH clients still needing legacy TLS - Microsoft Tech Community "

The article (link above) of MS mentions that gradually the percentage of rejected connections is increased. This would explain why every now and then the sending of mails is successful.

Anyone an idea of how I can solve this? I have used TLSv12 as parameter, so this contradicts with the error message. See code example below.

MailSocket = New SMTPSecureSocket
MailSocket.SSLEnabled = True
MailSocket.Address = "smtp.office365.com" 
MailSocket.SSLConnectionType = SSLSocket.SSLConnectionTypes.TLSv12
MailSocket.SMTPConnectionType = SMTPSecureSocket.SMTPConnectionTypes.STARTTLS 
MailSocket.Port = 587 

Thanks for helping out.

See this previous post.

https://forum.xojo.com/t/smtpsecuresocket-not-using-tls-1-2/67463/14