无法使用3个可能的验证器在SMTP服务器上使用用户名\”yourmail@gmail.com\”进行验证,返回验证器LOGIN,

px9o7tmv  于 2022-11-07  发布在  其他
关注(0)|答案(1)|浏览(316)

can you guys help me with this issue! I want to email notification as a confirmation of service. The email is working via localhost email google. This is working fine. However, when I host on the server (Centos Server) it is not working. I have already set "on" the "Less secure app access" also.
Please help
.env file

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=yourmail@gmail.com
MAIL_FROM_NAME="Test System"
MAIL_PASSWORD=yourpassword@123
MAIL_ENCRYPTION=tls

config/mail.php

<?php

return [

/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|

* /

'default' => env('MAIL_MAILER', 'smtp'),

/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
|            "postmark", "log", "array"
|

* /

'mailers' => [
    'smtp' => [
        'transport' => 'smtp',
        'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
        'port' => env('MAIL_PORT', 587),
        'encryption' => env('MAIL_ENCRYPTION', 'tls'),
        'username' => env('MAIL_USERNAME'),
        'password' => env('MAIL_PASSWORD'),
        'timeout' => null,
        'auth_mode' => null,
    ],

    'ses' => [
        'transport' => 'ses',
    ],

    'mailgun' => [
        'transport' => 'mailgun',
    ],

    'postmark' => [
        'transport' => 'postmark',
    ],

    'sendmail' => [
        'transport' => 'sendmail',
        'path' => '/usr/sbin/sendmail -bs',
    ],

    'log' => [
        'transport' => 'log',
        'channel' => env('MAIL_LOG_CHANNEL'),
    ],

    'array' => [
        'transport' => 'array',
    ],
],

/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|

* /

'from' => [
    'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
    'name' => env('MAIL_FROM_NAME', 'Example'),
],

/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|

* /

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

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

];

Error popup in server

Failed to authenticate on SMTP server with username "yourmail@gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "534", with message "534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbv\r\n534-5.7.14 6QwiGpAN3JU8gappy5A_Cl9KLH2CIjz98b5ufHVlyZK-VAesyRaqeQrx5RLudEYe6S9zR\r\n534-5.7.14 j5MPM-5qY6oL3dc6Fcvu5omIkkEus6rK_Wz8pAYdVSQo6tO3FEea26ujojWqiO5L>\r\n534-5.7.14 Please log in via your web browser and then try again.\r\n534-5.7.14 Learn more at\r\n534 5.7.14 https://support.google.com/mail/answer/78754 h13-20020a056a00230d00b004f427ffd485sm16382266pfh.143 - gsmtp\r\n". Authenticator PLAIN returned Expected response code 235 but got code "534", with message "534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbs\r\n534-5.7.14 M7gUR-WFJS5p6fdwdulgY_ECc3U6v49WszVBavDfPpGRm_qGZD-pRnZqVELJel_QbhfC6\r\n534-5.7.14 tfFapza74BulVzQiOQBRNVudGg-XdjDE-WVQB0xDmiXh0pJ1lFYIlN3braZrpj87>\r\n534-5.7.14 Please log in via your web browser and then try again.\r\n534-5.7.14 Learn more at\r\n534 5.7.14 https://support.google.com/mail/answer/78754 h13-20020a056a00230d00b004f427ffd485sm16382266pfh.143 - gsmtp\r\n". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at\r\n535 5.7.8 https://support.google.com/mail/?p=BadCredentials h13-20020a056a00230d00b004f427ffd485sm16382266pfh.143 - gsmtp\r\n".
Gmail

c6ubokkw

c6ubokkw1#

在响应中,您可以看到...Please log in via your web browser and then try again...。这表明您进入了OAuth流程。在localhost场景中,它可能工作正常,因为您之前已经批准了Gmail OAuth对话框。您必须在google控制台中注册/授权您的应用程序。
请看这里:https://developers.google.com/gmail/api/auth/about-auth

相关问题