iOS Question SMTP not sending email

mcqueccu

Well-Known Member
Licensed 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 = "xxxx@gmail.com"
    Dim smtpUserPassword As String = "xxxxxxx"
    
    Dim receipientEmail As String = "xxxxx@xxxx.com"
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
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
Top