Android Question Error using smtp

RVP

Active Member
Licensed User
Longtime User
I have an app wrote for a client that emails notifications to me if an error occurs while it is running, it has been working fine using gmail as the mail server, but now I need to switch it to work with an exchange server. IT has setup SMTP as an option for me to use, but I am getting an error when I try to send an email.

B4X:
Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then   
        smtpClient.Initialize("mail1.xxxxxx.com", 25, "xxxx@xxxxxx.com", "xxxxxxxxx", "SMTP")
        Send_EMail("This is a test","WO App EMail test")
    End If
End Sub
        
Sub Send_EMail(text As String,subject As String)
    
    smtpClient.StartTLSMode = False
    smtpClient.UseSSL = True
    smtpClient.AuthMethod = smtpClient.AUTH_LOGIN
    smtpClient.MailFrom = "WorkOrderSystem-NoReply@xxxxxxxx.com"
    smtpClient.To.Add("xxxxxxxx@gmail.com")
    smtpClient.Subject = Starter.EmpId & " " & subject
    smtpClient.Body = text
    smtpClient.Send
End Sub

Sub SMTP_MessageSent(Success As Boolean)
    Log(Success)
    If Success Then
        ToastMessageShow("EMail sent successfully", True)
    Else
        ToastMessageShow("Error sending EMail", True)
        Log(LastException.Message)
    End If


The LastExceptionMessage I am getting is:

javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xa43d0908: Failure in SSL library, usually a protocol error
error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER (external/boringssl/src/ssl/tls_record.cc:242 0xa352b64b:0x00000000)
 

drgottjr

Expert
Licensed User
Longtime User
exchange seems to use TLS, which is sort of an enhanced SSL. you've got TLS turned off. see what happens if you turn it on. (you may also have to try turning SSL off when activating TLS)
 
Upvote 0

RVP

Active Member
Licensed User
Longtime User
Tried that, I get an error that indicates TLS is not supported. And IT tells me I need to use SSL
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
Upvote 0
Top