8

Google is getting rid of less secure app access feature. I'm using smtp email service for my website's contact page. But after 30 May, 2022 this service will not work probably.

Is there any other way to give third party less secure app access to my Gmail account ..?

Can an app password solve this problem ..? I have doubts that setting app password will not give access either as google said this may not work for less secure app.

So is there any way to fix this so that the smtp email service works as it should ...?

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Soumya Roy
  • 265
  • 3
  • 11

3 Answers3

6

TLDR:

Caveats:

  • Initially, Gmail had automatically turned off my less secure apps setting because I hadn't used that test account in several months. I turned it on, but since I saw the message that it'd be disabled by 2022.05.30, I went ahead and set the app password. This means my current setup has both less secure apps AND app password enabled in my Gmail account, though I'm only using the app password for authentication.
  • My program usually ran from within WSL2 on top of Windows 11. Even after setting up the app password, my code was returning a gaierror: [Errno -3] Temporary failure in name resolution error when running from within WSL2. I then tried running it straight from Windows 11 and it worked just fine. I now need to fix the networking issue causing this, but it doesn't seem to be directly caused by using app password.

I hope this helps.

Leobeeson
  • 500
  • 6
  • 13
  • I understand how to setup an App password, but how do use it with smtp in a program - for example PHPMailer? – Chiwda May 30 '22 at 11:10
  • @Chiwda, you might want to check this PHP-specific answer: https://stackoverflow.com/questions/14456673/sending-email-with-php-from-an-smtp-server – Leobeeson May 31 '22 at 17:47
  • that answer doesn't use App Password which is different from a simple password. – Chiwda May 31 '22 at 22:57
  • 4
    @Chiwda Turn on 2 factor authentication, Generate APP Password and then in you code username is your account address and password is APP PASSWORD (not account password). – JTouchLogic Jun 03 '22 at 21:49
2

Note: 2-factor authentication needed to be enabled before proceeding.

Less secure apps (https://myaccount.google.com/u/0/lesssecureapps) options is deprecated.

We can use apppasswords functionality provided by Google using following link.
https://myaccount.google.com/u/0/apppasswords

Use 16 digit code provided by google instead of password and that should serve as authentication token.

enter image description here

Vaibhav Jain
  • 1,939
  • 26
  • 36
0

It can be done via 2 factor authentication and app password

Truck
  • 1