From May 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. You can read more about the update here
A large percentage of tutorials on connecting to Gmail covers authentication via supplying a username and password and turning off the "allow less secure app" settings on google. Any app we have now that uses this means of authentication will break as google will block anyone trying to sign in to your account from it: to keep your account safe.
Using Google App Password
A Google app password is a 16-digit passcode that allows an app or device to access your Google Account. With this authentication method, you will be signing in via the 16-digit passcode alone.
1) Set up a 2-Step-Verification for your account: you can skip this step if you have already set up a 2-Step-Verification on your account. You can also check this google tutorial to set up your 2-Step-Verification.
2) Generate your app password:
- Click on App passwords
- Select "Other (Custom name)" and input any name of your choice
- Then click generate to generate your passcode.
3) Copy your generated passcode
4) In your Django settings file, replace your EMAIL_HOST_PASSWORD variable with the new passcode you generated
5) If you are not using a Django app, just replace your email service settings password with the passcode you generated.
And voila, you are good to go!