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
Here is my code
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