Thank all of you for responding.
Code that I use is below. Teddybear wanted me to post it.
Sub RunSMTPTest
Dim smtpserver As String = email_settings.Get(0)
Dim smtpPort As Int = email_settings.Get(1)
Dim user As String = email_settings.Get(2)
Dim email_password As String = email_settings.Get(3)
smtp.Initialize(smtpserver, smtpPort, user, email_password, "smtp")
smtp.StartTLSMode = email_settings.Get(5)
smtp.UseSSL = email_settings.Get(6)
smtp.AuthMethod = smtp.AUTH_LOGIN
SendEmail(email_settings.Get(4), user, "subject test1", "body test 1")
End Sub
Public Sub SendEmail(ToEmail As String, from As String, Subject As String, body As String)
Try
smtp.To.Add(ToEmail)
smtp.Sender = from
smtp.Body = body
smtp.Subject = Subject
smtp.Send
Catch
Dim error_text As String
error_text = LastException.Message
errorscreen.show_error(Main.prompt(987) & ToEmail & Main.prompt(988) & Subject & error_text,Main.prompt(86),"yellow")
End Try
wait for SMTP_MessageSent(Success As Boolean)
If Success Then
errorscreen.show_error(Main.prompt(989) & ToEmail & Main.prompt(988) & Subject,Main.prompt(86),"yellow")
Else
errorscreen.show_error(Main.prompt(987) & ToEmail & Main.prompt(988) & Subject & error_text,Main.prompt(86),"yellow")
End If
End Sub
For Erel: The port is 587. I have also tried changing the smtp.AuthMethod to smtp.AUTH_LOGIN, smtp.AUTH_PLAIN and AUTH_CRAM_MD5.
For DarkoT, my example code is similar to yours, and I have tried changing the mail server smtp address to your office365 address, originally it was "smtp-mail.outlook.com"
Lastly I have tried toggling the startts and UseSSL enable and disbale combinations.
Just in case the full error is:
org.apache.commons.net.smtp.SMTPConnectionClosedException: Connection closed without indication.
at org.apache.commons.net.smtp.SMTP.__getReply(SMTP.java:199)
at org.apache.commons.net.smtp.SMTP.__sendCommand(SMTP.java:171)
at org.apache.commons.net.smtp.SMTP.__sendCommand(SMTP.java:186)
at org.apache.commons.net.smtp.SMTP.rcpt(SMTP.java:524)
at org.apache.commons.net.smtp.SMTPClient.addRecipient(SMTPClient.java:314)
at anywheresoftware.b4a.net.SMTPWrapper$1.run(SMTPWrapper.java:298)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Any additional help would be appreciated as to what to look for here?