gpt4 book ai didi

laravel - 无法使用 3 个可能的身份验证器在用户名\"yourmail@gmail.com\"的 SMTP 服务器上进行身份验证 Authenticator LOGIN 返回了预期的响应

转载 作者:行者123 更新时间:2023-12-04 19:31:33 26 4
gpt4 key购买 nike

你们能帮我解决这个问题吗!我想通过电子邮件发送通知作为服务确认。该电子邮件通过本地主机电子邮件谷歌工作。这工作正常。但是,当我在服务器(Centos 服务器)上托管时,它不起作用。我也已经将“不太安全的应用程序访问”设置为“开启”。
请帮忙
.env 文件

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
配置/邮件.php
<?php
返回 [
/*
|--------------------------------------------------------------------------
| 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'),
],
],
];
服务器弹出错误
未能使用 3 个可能的身份验证器在用户名“yourmail@gmail.com”的 SMTP 服务器上进行身份验证。身份验证器登录返回预期响应代码 235,但得到代码“534”,消息“534-5.7.14 \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"。身份验证器 PLAIN 返回了预期的响应代码 235,但得到了代码“534”,消息为“534-5.7.14 \r\n534-5.7.14 Please log in via your web browser and then try again.\r\n534-5.7.14 Learn更多信息请参见\r\n534 5.7.14 https://support.google.com/mail/answer/78754 h13-20020a056a00230d00b004f427ffd485sm16382266pfh.143 - gsmtp\r\n"。身份验证器 XOAUTH2 返回了预期的响应代码 250,但得到了代码“535”,消息为“535-5.7.8 用户名和密码不被接受。了解更多信息:\r\n535 5.7.8 https://support.google.com/mail/?p=BadCredentials h13-20020a056a00230d00b004f427ffd485sm16382266pfh.tp\r\r\r\n\n”。
邮箱

最佳答案

在回复中,您可以看到 ...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

关于laravel - 无法使用 3 个可能的身份验证器在用户名\"yourmail@gmail.com\"的 SMTP 服务器上进行身份验证 Authenticator LOGIN 返回了预期的响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71646561/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com