If you have 2FA two-factor authentication enabled for a Gmail account, you cannot use it as an alias to send emails by setting up the SMTP settings on Gmail. For that, you need to generate an App Password and use it in place of your actual password when setting up the SMTP details.
How to Generate Gmail App Passwords#
- Login to your Gmail account
- Navigate to the Google AppPasswords setting page https://security.google.com/settings/security/apppasswords
- In the
select app
chooseOther (custom name)
- Give it an arbitrary name and press generate
- This will give you 16 characters token
You can now use this token as your password in combination with your Gmail account and two-factor authentication will not be required.