当我运行代码时,我收到错误消息“无法使用3个可能的身份验证器使用用户名“ hello@gmail.com”在SMTP服务器上进行身份验证。身份验证器CRAM-MD5返回了预期的响应代码235,但得到了代码“ 535”,并显示了消息“” 535 5.7.0无效的登录名或密码“。Authenticator LOGIN返回了预期的响应代码250,但响应为空。Authenticator PLAIN返回了预期的响应代码250,但响应为空。
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文件是
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=hello@gmail.com
MAIL_PASSWORD=****
MAIL_ENCRYPTION=tls
答案 0 :(得分:1)
打开不太安全的应用访问权限
MAIL_MAILER = smtp
MAIL_HOST = smtp.gmail.com
MAIL_PORT = 465
MAIL_USERNAME=yourmail@gmail.com
MAIL_PASSWORD =您的Gmail密码
MAIL_ENCRYPTION = ssl
MAIL_FROM_ADDRESS=yourmail@gmail.com
答案 1 :(得分:0)
在您的环境中这样做:
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=***
MAIL_PASSWORD=***
MAIL_ENCRYPTION=tls
答案 2 :(得分:0)
每个端口使用不同的协议,您遇到的错误可能是由协议不匹配引起的。