简体   繁体   English

Laravel,无法使用 3 个可能的身份验证器使用用户名“”在 SMTP 服务器上进行身份验证

[英]Laravel, Failed to authenticate on SMTP server with username "" using 3 possible authenticators

I am trying to find out why this happens.我试图找出为什么会发生这种情况。

.env .env

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

mail.php邮件.php

<?php
return [

    'driver' => env('MAIL_DRIVER', 'smtp'),

    'host' => env('MAIL_HOST', 'smtp.gmail.com'),

    'port' => env('MAIL_PORT', 587),

    'from' => ['address' =>  '******@gmail.com', 'name' => 'Project'],

    'encryption' => env('MAIL_ENCRYPTION', 'tls'),

    'username' => env('******@gmail.com'),

    'password' => env('******'),

    'sendmail' => '/usr/sbin/sendmail -bs',

    'pretend' => false,
    'stream' => [
        'ssl' => [
            'allow_self_signed' => true,
            'verify_peer' => false,
            'verify_peer_name' => false,
        ],
    ],
];

This is the error这是错误

Failed to authenticate on SMTP server with username "" using 3 possible authenticators. Authenticator LOGIN returned Swift_TransportExce ▶
534-5.7.14 GVHg3-rU8SDpVLdwnIPviBCjKNnBRcxuU2N3-pcUWd0TeMbM_vULrHhQcVNXjhoewjrquW\r\n
534-5.7.14 Jttd6jNXfnledZiAMv-rjMvpnd01nas-2J2BYU_Krd4kzT-YmTR_HW9uW3S6Ts2jUxDaC8\r\n
534-5.7.14 XmT_TV9QqYXHXkTMcrX3OG9D4QyF4E6w7fwnu2bYZT36rZXTU-HqJwlWzJBv8-MC2P9xrN\r\n
534-5.7.14 cUd4-BirG0rfAjlDxy5bkbon3S_bIFSZQVd0-5wskctUR4do7F> Please log in via\r\n
534-5.7.14 your web browser and then try again.\r\n
534-5.7.14  Learn more at\r\n
534 5.7.14  https://support.google.com/mail/answer/78754 l5-v6sm1366079wrv.84 - gsmtp\r\n
" in C:\xampp\htdocs\wer\walrer\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php:457\n
Stack trace:\n

I checked email credentials and they are the same.我检查了电子邮件凭据,它们是相同的。 In this project I have used authentication , but can't find a solution to this one.在这个项目中,我使用了 authentication ,但找不到解决方案。

I think there is something wrong with your mail.php file.我认为您的mail.php文件有问题。

You should be passing the variable names to the env() function for username and password .您应该将变量名称传递给usernamepasswordenv()函数。

So this:所以这:

'username' => env('******@gmail.com'),

'password' => env('******'),

Becomes this:变成这样:

'username' => env('MAIL_USERNAME'),

'password' => env('MAIL_PASSWORD'),

Your .env file looks good.您的.env文件看起来不错。

You mail.php file should look like this:您的mail.php文件应如下所示:

<?php
return [

    'driver' => env('MAIL_DRIVER', 'smtp'),

    'host' => env('MAIL_HOST', 'smtp.gmail.com'),

    'port' => env('MAIL_PORT', 587),

    'from' => ['address' =>  '******@gmail.com', 'name' => 'Project'],

    'encryption' => env('MAIL_ENCRYPTION', 'tls'),

    'username' => env('MAIL_USERNAME', '******@gmail.com'),

    'password' => env('MAIL_PASSWORD', '******'),

    'sendmail' => '/usr/sbin/sendmail -bs',

    'pretend' => false,
    'stream' => [
        'ssl' => [
            'allow_self_signed' => true,
            'verify_peer' => false,
            'verify_peer_name' => false,
        ],
    ],
];

The value in the second parameter for the env() function, gets used if the .env key specified in the first parameter is not found.如果未找到第一个参数中指定的.env键,则使用env()函数的第二个参数中的值。

您需要在您的谷歌帐户中启用安全性较低的应用程序访问才能使其正常工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel:无法使用 2 个可能的身份验证器在 SMTP 服务器上使用用户名进行身份验证 - Laravel :Failed to authenticate on SMTP server with username using 2 possible authenticators 使用 2 个可能的身份验证器在用户名“***”的 SMTP 服务器上进行身份验证失败 - Failed to authenticate on SMTP server with username “***” using 2 possible authenticators 无法使用2个可能的身份验证器在SMTP服务器上使用用户名进行身份验证 - Failed to authenticate on SMTP server with username using 2 possible authenticators Swift_TransportException无法使用共享主机上的2个可能的身份验证器使用用户名email@domain.com在SMTP服务器上进行身份验证 - Swift_TransportException Failed to authenticate on SMTP server with username email@domain.com using 2 possible authenticators on shared host PHP Swift 邮件程序:无法使用 2 个可能的身份验证器在 SMTP 上进行身份验证 - PHP Swift mailer: Failed to authenticate on SMTP using 2 possible authenticators 使用 Laravel Jetstream 使用用户名在 SMTP 服务器上进行身份验证失败 - Failed to authenticate on SMTP server with username using Laravel Jetstream Laravel 无法使用用户名在 SMTP 服务器上进行身份验证 - Laravel Failed to authenticate on SMTP server with username 无法在 SMTP 服务器上进行身份验证 Laravel 6 - Failed to authenticate on SMTP server in Laravel 6 如何解决 Laravel SMTP 中 2 个可能的身份验证器错误 - How to resolve 2 possible authenticators error in Laravel SMTP Swift_TransportException无法使用用户名在SMTP服务器上进行身份验证 - Swift_TransportException Failed to authenticate on SMTP server with username
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM