Failed to authenticate on SMTP server error using gmail

后端 未结 8 472
鱼传尺愫
鱼传尺愫 2020-12-23 09:34

I\'m trying to set up email for my first laravel project, and was thrilled that there\'s a laracast for it: https://laracasts.com/lessons/mailers

I\'ve followed the

相关标签:
8条回答
  • 2020-12-23 10:14

    Nothing wrong with your method, it's a G-mail security issue.

    1. Login g-mail account settings.

    2. Enable 2-step verification.

    3. Generate app-password.

    4. Use new-generated password in place of your real g-mail password.

    Don't forget to clear cache.

    php artisan config:cache.
    php artisan config:clear.
    
    MAIL_DRIVER=smtp
    MAIL_HOST=mailtrap.io
    MAIL_PORT=587
    MAIL_USERNAME=yourgmailid@gmail.com
    MAIL_PASSWORD=generatedAppPassword
    MAIL_ENCRYPTION=tls
    
    0 讨论(0)
  • 2020-12-23 10:14

    If you still get this error when sending email: "Failed to authenticate on SMTP server with username "youremail@gmail.com" using 3 possible authenticators"

    You may try one of these methods:

    1. Go to https://accounts.google.com/UnlockCaptcha, click continue and unlock your account for access through other media/sites.

    2. Using a double quote password: "your password" <-- this one also solved my problem.

    0 讨论(0)
  • 2020-12-23 10:18

    If you still get this error when sending email: "Failed to authenticate on SMTP server with username "example@gmail.com" using 3 possible authenticators"

    You may try one of these methods:

    Go to https://accounts.google.com/UnlockCaptcha, click continue and unlock your account for access through other media/sites.

    Use double quote for your password: like - "Abc@%$67eSDu"

    0 讨论(0)
  • 2020-12-23 10:21

    This is how I solved this issue:

    1. Change the .env file as follow

    Screenshot Reference

    1. Never forget to restart the server after you change the .env file
    0 讨论(0)
  • 2020-12-23 10:21

    Change the .env file as follow

    MAIL_DRIVER=smtp
    MAIL_HOST=smtp.googlemail.com
    MAIL_PORT=587
    MAIL_USERNAME=email_address@gmail.com
    MAIL_PASSWORD=password
    MAIL_ENCRYPTION=tls
    

    And the go to the gmail security section ->Allow Less secure app access

    Then run

    php artisan config:clear
    

    Refresh the site

    0 讨论(0)
  • 2020-12-23 10:31

    I had the same problem and I've already tried everything and nothing seemed to work until I just changed the 'host' value in config.php to:

     'host' => env('smtp.mailtrap.io'),
    

    When I changed that it worked nicely, somehow it was using the default host " smtp.mailtrap.org" and ignoring the .env variable I was setting.

    After making some test I realize that if I placed the env variable in this order it would worked as it shoulded:

    MAIL_HOST=smtp.mailtrap.io

    
MAIL_DRIVER=smtp

    
MAIL_PORT=2525


    MAIL_USERNAME=xxxx

    
MAIL_PASSWORD=xxx

    
MAIL_ENCRYPTION=null

    0 讨论(0)
提交回复
热议问题