简体   繁体   中英

Failed to authenticate on SMTP server with username "hello@gmail.com" using 3 possible authenticators

When i run the code i got error "Failed to authenticate on SMTP server with username "hello@gmail.com" using 3 possible authenticators. Authenticator CRAM-MD5 returned Expected response code 235 but got code "535", with message "535 5.7.0 Invalid login or password ". Authenticator LOGIN returned Expected response code 250 but got an empty response. Authenticator PLAIN returned Expected response code 250 but got an empty response."

config/mail.php

return [
    'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'smtp.mailtrap.io'),
    'port' => env('MAIL_PORT', 2525),
    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'hello@gmail.com'),
        'name' => env('MAIL_FROM_NAME', 'Hello'),
    ],

    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'sendmail' => '/usr/sbin/sendmail -bs',

    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],

    'log_channel' => env('MAIL_LOG_CHANNEL'),
];

.env file is

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=hello@gmail.com
MAIL_PASSWORD=****
MAIL_ENCRYPTION=tls

do it like this in your env:

MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=***
MAIL_PASSWORD=***
MAIL_ENCRYPTION=tls

Turn on Less secure app access

在此处输入图片说明

MAIL_MAILER=smtp

MAIL_HOST=smtp.gmail.com

MAIL_PORT=465

MAIL_USERNAME=yourmail@gmail.com

MAIL_PASSWORD=yourgmailpassword

MAIL_ENCRYPTION=ssl

MAIL_FROM_ADDRESS=yourmail@gmail.com

Each port uses a different protocol, errors like the one you had can be caused by the protocol mismatch.

  1. Change your SMTP port to 25 or 465 or 587 or 2525 in .env file,
  2. Save and restart the server by php artisan serve.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM