I display that MsgBox first, so the function works. I added the net library. No error message, email is still not sent. Can anyone help? I am a beginner in B4A.
Sorry, I formatted below. I tried to follow what you wrote but MessageSent does not get triggered... I don't get any window pop up. Can you fix my code?
Thank you
B4X:
Private Sub Button1_Click
xui.MsgboxAsync("Hello world!", "B4X")
smtpClient.Initialize("smtp.gmail.com", 587, "xxxxx@gmail.com", "xxxxxx", "SMTP")
smtpClient.StartTLSMode = True
smtpClient.To.Add("xxxxxx@gmail.com")
smtpClient.Subject ="Test subject"
smtpClient.Body ="TestingBody"
Dim sf As Object = smtpClient.Send
Wait For (sf) MessageSent (Success As Boolean)
If Success Then
xui.MsgboxAsync("OK", "B4X")
Else
xui.MsgboxAsync("Error", "B4X")
End If
End Sub