You need to be sure ms
has an instance of SMTPSecureSocket. You don’t want to create a new instance if one is already busy.
if ms = nil then
ms = new SMTPSecureSocket
end
ms.Address = emailServiceAddress
...
You need to be sure ms
has an instance of SMTPSecureSocket. You don’t want to create a new instance if one is already busy.
if ms = nil then
ms = new SMTPSecureSocket
end
ms.Address = emailServiceAddress
...
Sorted the issue.
Here is my WORKING CODE:
If ms = Nil Then
ms = New SMTPSecureSocket
End If
ms.Address = "mail.serverwarp.com"
ms.Port = emailPort587
ms.SSLConnectionType = SSLSocket.SSLConnectionTypes.TLSv1
ms.SMTPConnectionType = SMTPSecureSocket.SMTPConnectionTypes.SSLTLS
ms.SMTPConnectionMode = 0
ms.SSLEnabled = True
ms.Username = emailname
ms.Password = emailPass
var mail as New EmailMessage
mail.FromAddress = emailname
mail.AddRecipient("amy@lltconnect.com")
mail.Subject = "test email"
mail.BodyPlainText = "testing some new code."
mail.Headers.AddHeader("X-Mailer","SMTP Test")
ms.Messages.Add(mail)
Try
ms.SendMail
Catch e As RuntimeException
MessageBox(e.Message)
End Try
I filed a Feedback case regarding the documentation online -
63367 - Bug: Documentation - SMTPSecureSocket code not working in 2002r2
The Nil Object Exception was caused when I accidentally called the SendMail method of the SMTPSecureSocket property of the module directly instead of calling the sendTest method on the module.
[facepalm]
But I did learn that my code on a published app is broken. I will be porting all my apps over to 2020r2.
Same here, seems working fine with Xojo 2020r2.1
Registry key: Computer\HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command
Set as: "C:\Program Files\Google\Chrome\Application\chrome.exe" --single-argument %1
I get a silent failure on the exact working code with the newest version of Xojo. Did something change?
The only change I can think of is only if you are on macOS… that is that we updated the framework to the macOS 11 SDK for Intel. It’s certainly possible that TLSv1 is no longer available.
I suggest using the auto-negotiation mode by setting it to SSLv23 as was mentioned above. It’ll start with TLSv1.2 and work it’s way downward until it finds one that works.
I found out that I was adding in a second header BUT it’s still not working - I am going to run through my connection options later today when I wake back up, hopefully sleeping on it will end up shaking some ideas loose.
What I’ve found broken recently on SMTP was the combination SSL/TLS and protocol TLSv1.2. It does nothing. No connection, no error, no events… on Windows. It was freezing my app when the users configured it this way.
Wow. I may have to build / deploy to test it, then.
As soon as the user changed it to StartTLS it worked as expected.
Well, it works perfectly as soon as I deployed it to Xojo’s servers while it failed miserably on testing in Windows.
Thank you for sharing your experience - you just saved me … not a small amount of work.