As the security of Google's email account is gradually improved, some clients may not be able to directly create a Google account even if you have checked a lot of possible failure reasons. In fact, many applications have enabled 2-step verification function to enhance security performance, such as having to enter the code in SMS or verification code in email again then you will be able to log into its server, but for mail clients such as pbx or outlook that cannot use 2-step verification function, you might have to try Google's APP password in system email setup.
Below debug log in SSH shows authentication failure even you use correct password for your gmail id.
Below steps are shown how to enable 2-step verification and then generate APP password for gmail email id becase only have enabled 2-step verification function for your gmail id then you will be able to generate APP password.
Step1. Launch google website and click on 'Sign in' on right up corner.
Step2. Input your google account mail id then click on 'Next'.
Step3. Input password for your google account and click on 'Next'.
Step4. Click on avatar on right up corner then click on 'Google Account'.
Step5. Choose 'Security' tab then click on '2-Step Verification'.
Step6. Click on 'GET STARTED'.
Step7. Input password for your google account then click on 'Next'.
Step8. Choose your country, input your mobile phone number, choose 'Text message' then click on 'Next'. Your phone will receive one SMS with 6-digit verification code.
Step9. Input the code then click on 'Next'.
Step10. Click on 'TURN ON' to turn on 2-step verification.
Step11. You will see 2-step verification is on then rolling to the bottom of page and click on 'App passwords'.
Step12.Input the name and create the APP password
Step13. You will see 16-character app password generated and you have to enter it in system email setup in pbx first then click on 'DONE' because you won't see the password again after clicking on 'DONE'.
Step14. Save email configurations in pbx and test again.
Step15. After testing it successfully, click on 'DONE' in step13 then you will see the device you have added and in security tab in google account you will see one app password you have generated for 'Yeastar-IPPBX' device.
Step16. If you need to set up gmail email in some more PBXS, you can follow step12 to generate more app passwords.