iOS Question Error OSStatus error -9807 - Sending Email

virpalacios

Active Member
Licensed User
Longtime User
Hi All, Good Day, Good Night and Good Afternoon :), Greetings,
I am getting Error Message -9807 when sending mail, Here is the code
Sending Mail Routing:
Sub enviar_correo_denuncia
    Dim correo_body As String
    Dim SMTPD As SMTP   
    SMTPD.Initialize("mail.apo.gob.px", 587, "reports@apo.gob.px", "Mission2025io", "SMTPD")
    SMTPD.StartTLSMode = True
    SMTPD.DebugLogs = True
    SMTPD.To.Add("reports@apo.gob.px")
    SMTPD.Subject = "APA Click Denuncia Item no Encontrado"
    correo_body = "Usuario " & Estructuras.usuario_registrado.nombre_completo & " ha realizado un registro de item no encontrado con codigo de barra " & Estructuras.usuario_denuncia.codigo_barra & CRLF
    correo_body = correo_body   & " encontrado en el local " & Estructuras.usuario_denuncia.nombre_local & " ubicado en " & Estructuras.usuario_denuncia.ubicacion_local & CRLF
    correo_body = correo_body & " con los siguientes detalles "  & Estructuras.usuario_denuncia.detalles_denuncia
    SMTPD.Body = correo_body
    SMTPD.Send 
End Sub

Sub SMTPD_MessageSent(Success As Boolean)
    If Success Then
        hd.ToastMessageShow("Su reporte ha sido enviado a reports@apo.gob.pa !", True)
        Log("Mail Send")
    Else
        hd.ToastMessageShow("Error Sending Mail", True)
        Log(LastException.Message)
    End If
End Sub

After checking in Apple Site error -9807 means "errSSLXCertChainInvalid", I had an issue with my Android version, so I tried this method from Adroid



Android Code:
    Dim ctm As CustomTrustManager
    ctm.InitializeAcceptAll
    SMTPD.SetCustomSSLTrustManager(ctm)

This work for Android, however I am getting this mesaage from debbuging "The operation couldn’t be completed. (OSStatus error -9807.)"

Here the Logs

1765508046494.png


I am using B4i 10.00 and IOS 26 on the device

Thank in Advance for your comments
 

virpalacios

Active Member
Licensed User
Longtime User
Hi Erel thanks for you replay, Yes I tried with port 25, but not success, It looks like a certificate issue, I tested a similar mail server from other customer (Outlook 365) and mail works fine, problematic server is going to renew and check the certificates.

Meanwhile
(Android Version)
In order to work with this problematic mail server I had to set Accept Mail Certificate in my Android version

Accept all certificates in Android:
Dim ctm As CustomTrustManager
    ctm.InitializeAcceptAll
    SMTPD.SetCustomSSLTrustManager(ctm)

However I could't find an equivalent option for SMTP (Sending Mail) in IOS?, or alternatives to bypass certificate issues,



Best Regards and Thanks Again for you support

:D 👋
 
Last edited:
Upvote 0

virpalacios

Active Member
Licensed User
Longtime User
Hi Erel, thanks a lot for your explanation!!!, I talk with it department so they going to renew mail certificates, hope they can fix it,

Best Regards :D 👋
 
Upvote 0
Top