Hi, this is the first time I am going to use .Net library. I want to use the SMTP Object to send an email, but I am getting this error:
This is my code:
If I change SMTP.StartTLSMode to True, I'm getting the same error. But if I change the port to 465 and SMTP.StartTLSMode = True, I'm getting this (java.net.SocketTimeoutException: Read timed out). Same if I change SMTP.StartTLSMode = False with port 465.
I also tried using SMTP.UseSSL = True, this is the error:
If I set SMTP.UseSSL to false, this is the err message: (java.net.SocketTimeoutException: Read timed out).
B4X:
java.lang.RuntimeException: Empty writer returned: 503-All RCPT commands were rejected with this error:
503-Sender verify failed
503 Valid RCPT command must precede DATA
This is my code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
If FirstTime Then
SMTP.Initialize("mail.mydomain.com", 587, "[email protected]", "password", "SMTP")
SMTP.StartTLSMode = false
End If
SMTP.To.Add("[email protected]")
SMTP.Subject = "This is the subject"
SMTP.Body = "This is the message body."
'SMTP.AddAttachment(File.DirRootExternal, "somefile")
SMTP.Send
End Sub
If I change SMTP.StartTLSMode to True, I'm getting the same error. But if I change the port to 465 and SMTP.StartTLSMode = True, I'm getting this (java.net.SocketTimeoutException: Read timed out). Same if I change SMTP.StartTLSMode = False with port 465.
I also tried using SMTP.UseSSL = True, this is the error:
B4X:
java.lang.RuntimeException: Empty writer returned: 503-All RCPT commands were rejected with this error:
503-Sender verify failed
503 Valid RCPT command must precede DATA
If I set SMTP.UseSSL to false, this is the err message: (java.net.SocketTimeoutException: Read timed out).