iOS Question B4i not sending Email

Falcon

Member
Licensed User
Good Day Code Warriors,

I am able to send emails in B4A no problem, but for some reason I cannot get it to work in B4i.

The code I use use in B4A:

B4X:
       Dim Mail as SMTP

        Mail.Initialize(strSMTPServerAddress, strSMTPServerPort, strUserName, strPassword, "Email")
        Mail.UseSSL = False
        Mail.To.Add(strMailToAddress)
        Mail.Subject = "Test"
        Mail.Body = "Hello World"
        Mail.Sender = strSenderEmailAddress
   
        Mail.Send

Now if I use the exact same code in B4i with the exact same Server credentials, I get the following:

Application_Start
Application_Active
C: Attempting to connect to server at: mail.xxxxxxxxx.co.za:25 <----- I just changed my domain name here not to show it in the forum, but it is correct
S: 220 winmails03.hostserv.co.za
C: EHLO localhost

S: 250-winmails03.hostserv.co.za Hello [105.226.177.206]
S: 250-SIZE 26214400
S: 250-AUTH LOGIN CRAM-MD5
S: 250-8BITMIME
S: 250 OK
C: AUTH LOGIN

C: aW5mbB3XZlY3Jliuc3Rob2xpZGF5cy5jby56YQ==

C: S2xlaW5tbjk5kMzAxMA==

S: 334 VXNlmnj5hbWU6
S: 535 Authentication failed

When I translate the Base64 strings above, it is my Username, Password (They are correct) and then a string that just says 'Username:'

Now it is saying Authentication Failed but I cannot understand why, since my Username & Password are correct.

Any idea what I am doing wrong here?

Thank you for your time,

Regards,
Jacques,
 

Falcon

Member
Licensed User
Hi Erel, thanks for the reply.

No error actually occurs, it just does not send the message.
The 'MessageSent' event also does not fire.
 
Upvote 0

Falcon

Member
Licensed User
My apologies Erel, the 'MessageSent' event does in fact fire, but 'Success' parameter = 0 and I get the Log message as shown above.
No other errors occur.

My event sub is simply:

B4X:
Private Sub Email_MessageSent(Success As Boolean)
   
    Msgbox("Message sent","")
    
End Sub
 
Upvote 0

Falcon

Member
Licensed User
Thank you very much for the help Erel I appreciate it.

I get this error:
<B4IExceptionWrapper: Error Domain=SKPSMTPMessageError Code=535 "Invalid username or password." UserInfo={NSLocalizedDescription=Invalid username or password., NSLocalizedRecoverySuggestion=Go to Email Preferences in the application and re-enter your username and password.}>

But I can't understand why since my Username & password are correct. I have checked them 10 times, I actually copy and pasted them from my working VB.Net code so I know they are 100% correct.
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
I think am having similar problem, have you been able to solve yours?

 
Upvote 0
Top