For security reasons, gmail SMTP servers do NOT allow authentication with your normal google account password. Google's gmail SMTP servers will only allow you top authenticate with a generated application specific password. You need 2-factor authentication (2FA) enabled on your Gmail account in order to create app specific passwords.
Do not worry though, enabling 2FA will not prevent the system from being able to send emails, because, like an API key, app passwords provide a way to bypass 2FA.
Please note, you MUST update the app specific passwords if you reset your account credentials.
Here is documentation for enabling 2-factor authentication (2FA) on Gmail and creating an app specific password for SMTP access:
Enabling 2FA on Gmail
- Go to your Gmail account settings (click on the gear icon in the top right corner)
- Select "Security"
- Under "Signing in to Google," click 2-Step Verification and select "Get started"
- Choose the verification method you want to enable - this adds an extra step to verify your identity when logging into your Gmail account. Common options are text message codes, Google Authenticator app codes, security keys, etc.
- Follow the on-screen instructions to setup your preferred 2FA method. Confirm your phone can receive text messages or download the Google Authenticator app to get verification codes.
Creating an App Specific Password for SMTP
- Once 2FA is enabled, sign in and go back to your Gmail Account Settings
- Select "Security"
- Under "Signing in to Google," go to App Passwords
- You may need to re-verify your 2FA login at this step
- Select "Mail" and choose the device/app that needs the password
- Gmail will generate a 16-character password unique to that app. Copy and save this password.
- When configuring your email client or SMTP app, use your regular Gmail email address as the username and the 16-character App Password you generated as the password.
- The app you authorized can now access your Gmail account using SMTP/IMAP with the unique app password rather than your main account password.
This allows you to use 2FA for enhanced Gmail security while still granting applications SMTP access. Again, as stated earlier it is important that you MUST update the app specific passwords if you ever change or update your normal google account credentials.
Comments
0 comments
Please sign in to leave a comment.