In Google Mail, you must allow "less secure" apps access in order for your SMTP settings to work. There are two places this setting must be enabled: Instead of using SMTP, you will need to connect your mailbox to Google via OAuth if you are using 2FA. ...
How do I fix SMTP Gmail failed?
The second option is to enable 'Less secure apps' within GMAIL.
- Log into your GMAIL account.
- Navigate to the 'Less secure apps' page.
- Toggle to turn this feature 'ON'.
- Wait at least 1 hour for Google to update this setting.
- Test your mail application again. It should now send correctly via SMTP.
How do I enable Gmail SMTP?
How to Enable IMAP/POP3/SMTP for Gmail Account
- Go to the "Settings", e.g. click on the "Gears" icon and select "Settings".
- Click on "Forwarding and POP/IMAP".
- Enable "IMAP Access" and/or "POP Download"