iOS Question SMTP not sending email

mcqueccu

Well-Known Member
Licensed User
Longtime User
I am having problem sending email with SMTP. Same code and Credentials work well in B4A and B4J but B4i is giving the error below

B4X:
started
false
<B4IExceptionWrapper: Error Domain=SKPSMTPMessageError Code=-3 "Unable to connect to the server." UserInfo={NSLocalizedDescription=Unable to connect to the server., NSLocalizedRecoverySuggestion=Try sending your message again later.}>


Here is my code
B4X:
Sub Process_Globals
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private xui As XUI
    
    Dim smtpServer As String = "smtp.gmail.com"
    Dim smtpPort As Int  = 587
    Dim smtpUserEmail As String = "[email protected]"
    Dim smtpUserPassword As String = "xxxxxxx"
    
    Dim receipientEmail As String = "[email protected]"
End Sub


B4X:
Sub Button1_Click
    Log("started")
    Dim smtp As SMTP
    smtp.Initialize(smtpServer, smtpPort,smtpUserEmail, smtpUserPassword, "smtp")
    smtp.StartTLSMode = True
    smtp.UseSSL = True
    smtp.Subject = "This is Subject"
    smtp.Body = "Hello world"
    smtp.To.Add(receipientEmail)
    smtp.Send
    Wait For smtp_MessageSent(Success As Boolean)
    Log(Success)
    Log(LastException)
End Sub
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
This is what the debuglogs says

B4X:
Application_Start
Application_Active
started
C: Attempting to connect to server at: smtp-relay.sendinblue.com:587
Beginning TLSv1...
false
<B4IExceptionWrapper: Error Domain=SKPSMTPMessageError Code=-3 "Unable to connect to the server." UserInfo={NSLocalizedDescription=Unable to connect to the server., NSLocalizedRecoverySuggestion=Try sending your message again later.}>
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
1. Yes, the device is connected to the internet, and I am using Hosted Builder to compile
2. Upon your advice (am using using only one at a time)

Findings

smtp.gmail.com is working with StartTLS = True

whiles

smtp-relay.sendinblue.com works with useSSL = true
 
Upvote 0
Top