On the to-do list for the next version of my app is support for Gmail and Office 365 with OAuth. The Chilkat plugin has examples. But they are a bit bare.
I’ve taken this code from my console app that is used to send a simple email message. This is not copy and paste code but should give you a comparison of how it was done with SMTPSecureSocket vs CURLEmailMBS and CURLSMBS. Obviously you must have the Monkeybread plugins to use this code. Hope this helps someone.
Old SMTPSecureSocket Connection Code:
Dim Server,UserName,Password,fromAddress,toAddress,Subject,Message as String
Dim SMTPConnect as New SMTPSecureSocket
SMTPConnect.Address=Server
SMTPConnect.port = Port
SMTPConnect.Secure = True
SMTPConnect.ConnectionType = SSLSocket.TLSv12
type or paste code here
New CURLEmailMBS Connection Code
Dim Server,UserName,Password,fromAddress,toAddress,Subject,Message as String
Dim SMTPConnect as New CURLEmailMBS
Dim c as New CurlSMBS
SMTPConnect.SMTPServer=Server
c.OptionPort = Port
c.OptionUseSSL= c.kFTPSSL_ALL
c.OptionSSLVersion=5
Old SMTPSecureSocket Message Creation & Sending Code:
Dim mail as New EmailMessage
mail.FromAddress=fromAddress
mail.subject= Subject
mail.AddRecipient toAddress
mail.bodyPlainText = Message
SMTPConnect.RemoveAllMessages
SMTPConnect.Messages.Append mail
SMTPConnect.SendMail
Do
App.DoEvents
Loop Until Sent=True
New CURLEmailMBS Message Creation and Sending Code
SMTPConnect.SetFrom fromAddress,""
SMTPConnect.subject= Subject
SMTPConnect.Addto toAddress,""
SMTPConnect.PlainText = Message
if c.SetupEmail(SMTPConnect) Then
dim er as Integer = c.Perform
if er = 0 then
Print "Email was sent successfully!"
Else
Print "Curl Server Error: "+Er.ToString+" "+c.LasterrorMessage
end if
Else
Print "Curl Client Error: "+c.Lasterror.ToString+" "+c.LasterrorMessage
End If
The OptionSSLVersion numbers from the Monkeybread Documentation:
TLSv1.0 4 TLS v1.0 or later (Added in 7.34.0)
TLSv1.1 5 TLS v1.1 or later (Added in 7.34.0)
TLSv1.2 6 TLS v1.2 or later (Added in 7.34.0)
TLSv1.3 7 TLS v1.3 or later (Added in 7.52.0)
So should support TLS v1.1 or later with the 5 that I set.
It may be a few more days before I have your solution replaced into this project, but I would definitely consider your post the answer to my original question. Thank you so much for your help!
Xojo is risking a new “Facebook crash” (2024-03-05) event, but now in their user base. Once everything starts to blow up, they will need to rush and do in 3 hours what they did not in 3 years.
What is so difficult about implementing TLS 1.3? Are there license costs for this or might the entire technical substructure have to be changed?
Otherwise, I can’t think of any sensible reason why the protocol that was introduced in 2018 (TLS 1.2 dates back to 2008) is not supported even after almost six years…
As more and more providers mandate the use of TLS 1.3, it is slowly becoming urgent.