Sending email fails when two factor authentication is on for Gmail

后端 未结 2 1680
半阙折子戏
半阙折子戏 2020-12-02 05:20

I am using my Gmail account and smtp.gmail.com inside my web application to test and send email. when two factor authentication is ON for my Gmail account, it f

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 06:01

    Create a custom app in you Gmail security settings.

    1. Log-in into Gmail with your account
    2. Navigate to https://security.google.com/settings/security/apppasswords
    3. In 'select app' choose 'custom', give it an arbitrary name and press generate
    4. It will give you 16 chars token.
    

    Use the token as password in combination with your full Gmail account and two factor authentication will not be required.

    Note: The link in step 2 will work only if you have 2-factor-authentication enabled.

提交回复
热议问题