Page 1 of 2

SmtpClient() does not connect to gmail.

Posted: Tue Feb 01, 2022 12:00 pm
by PedroAlex
Hello!

SMTPClient():new( "smtp.gmail.com", 465,, , 3) fail to conect the gmail server.
Looks like google changed the security settings for accessing email servers.
Does anyone know if there is a solution to work around this problem?

xBase 2.0.1176

Re: SmtpClient() does not connect to gmail.

Posted: Tue Feb 01, 2022 3:21 pm
by rdonnay
This is what I have been using for many years and it still works.

cSMTPServer := 'smtp.gmail.com'
cPort := "465"
oSmtp := SMTPClient():new( Alltrim(cSMTPServer), Val(cPort),, oLogWriter, 2 )

Re: SmtpClient() does not connect to gmail.

Posted: Wed Feb 02, 2022 2:54 am
by Piotr D
Hi Pedro,
for gmail try to use port 587.

Piotr

Re: SmtpClient() does not connect to gmail.

Posted: Wed Feb 02, 2022 9:54 am
by PedroAlex
Roger and Poitr,

SmtpClient doesn't work anymore for me.
something happened that all customers with gmail are reporting the same problem.

I made a small program to test and reproduce the situation.
Can you please test with your version of xbase and report the result
Teste_GMAIL.rar
(15.58 KiB) Downloaded 348 times

Re: SmtpClient() does not connect to gmail.

Posted: Thu Feb 03, 2022 6:16 am
by rdonnay
I sent a gmail message to you using my authentication.
Everything was a success.

I must tell you that I have had a Gmail account for about 20 years, so I am grandfathered in.
I am guessing that it is a problem with your account, not with SMTPClient().

Re: SmtpClient() does not connect to gmail.

Posted: Thu Feb 03, 2022 7:36 am
by PedroAlex
Hi Roger,
Thanks for answering,

I received your test emails.
but with my version of xbase it doesn't work with any gmail account.
I've been studying Alaska xbase developments and there have been a lot of changes to SmtClient() and MimeMessage().
I suspect my version 2.0.1176 has issues that have been resolved in the newer versions!
Turns out my subscription is expired.
Can you confirm your version of Alaska?

Many Thanks!

Note : Can anyone else who has an equal or lower version inform the test result?

Re: SmtpClient() does not connect to gmail.

Posted: Thu Feb 03, 2022 1:33 pm
by rdonnay
Xbase++ (R) Compiler 2.00.1542 Dec 10 2021

Re: SmtpClient() does not connect to gmail.

Posted: Fri Mar 25, 2022 10:55 pm
by Diego Euri Almanzar
I had a lot of trouble creating a SMPT client object using the GMAIL server.

I was able to overcome it by enabling the option for "UNSAFE APPS" in the settings
of the GMAIL account.

To enable it, it is recommended to perform the following steps:



1.- Click on the image of your Gmail account.



2.- Then click on "Google Account"



3.- Click on “Security”



4.- Go to the section “Access of insecure applications” and click on “Activate access”



5.- Finally activate "Allow access to insecure applications"




The version of Alaska that I use is 2.00.1503


Best regards

Re: SmtpClient() does not connect to gmail.

Posted: Wed Apr 06, 2022 10:49 am
by PedroAlex
Diego,

5.- Finally activate "Allow access to insecure applications"

If I figure out this switch, send gmail, works fine!

but this feature expires on 31 May 2022.!

Do you know any more solution?

Re: SmtpClient() does not connect to gmail.

Posted: Wed Apr 06, 2022 11:47 am
by PedroAlex
So!

* Starting May 30, 2022, Google will no longer support the use of third-party apps or devices
* which ask you to sign in to your Google Account using only your username and password.

* Instead of authenticating with your GMail username/password, a GMail user can create an App Password
* and then login using their username/app_password. It's literally the same, except it allows a GMail
* account owner to isolate passwords to specific applications.

* The Gmail account owner would first need to make sure she has 2-Step Verification setup for her account.
* Note: The 2FA verification is not a factor when authenticating with an app password. The 2FA is required
* to setup app passwords in the Google account console. See https://support.google.com/accounts/answer/185833

* After the GMail account owner has setup his app password, he simply uses the app password instead of his GMail account password.

It was simply for this reason that smtpclient did not work...