Android Question I should send an email with google but I find error!

ivanomonti

Expert
Licensed User
Longtime User
i am using this code after updating the library as proposed in a post by @Erel but i have no success

Dim smtpServer As String = "smtp.gmail.com"
Dim smtpPort As Int = 587
Dim smtpUserEmail As String = "[email protected]"
Dim smtpUserPassword As String = "-----------------------------------------------------------"

Dim receipientEmail As String = "[email protected]" ' email client

B4X:
Log("started")
        Dim smtp As SMTP
        smtp.Initialize(smtpServer, smtpPort,smtpUserEmail, smtpUserPassword, "smtp")
        smtp.StartTLSMode = True
        smtp.UseSSL = True
        smtp.Subject = "MIASmart Social AI"
        smtp.Body = "CODE: " & code
        smtp.To.Add(receipientEmail)
        smtp.Send
        Wait For smtp_MessageSent(Success As Boolean)
        Log(Success)
        Log(LastException)
 

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
Are you sure the Google account you're attempting to use has enabled 3rd party mail for your app? It is off by default.

Under the "Set up Gmail with older versions of Outlook and other clients" heading, turn on less secure apps.
 
Upvote 0
Top