简体   繁体   English

使用 Laravel Jetstream 使用用户名在 SMTP 服务器上进行身份验证失败

[英]Failed to authenticate on SMTP server with username using Laravel Jetstream

I'm learning how to send email to the user whenever their system role change using Laravel 8 and I had this issue where most tutorials that I'm following requires the Google Account to turn on the Less Secure Apps, but I cannot change the settings in the Google Account anymore it says This setting is no longer available .我正在学习如何在使用 Laravel 8 更改系统角色时向用户发送电子邮件,并且我遇到了这个问题,我正在遵循的大多数教程都需要 Google 帐户打开不太安全的应用程序,但我无法更改设置在 Google 帐户中不再显示This setting is no longer available I am using Laravel and Jetstream.我正在使用 Laravel 和 Jetstream。 Below is the error I'm getting:以下是我得到的错误:

Failed to authenticate on SMTP server with username "myEmail@gmail.com" using the 
following authenticators: "LOGIN", "PLAIN", "XOAUTH2". Authenticator "LOGIN" returned 
"Expected response code "235" but got code "535", with message "535-5.7.8 Username and 
Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/? 
p=BadCredentials j2-20020a654282000000b003fe28130b12sm5399227pgp.62 - gsmtp".". Authenticator 
"PLAIN" returned "Expected response code "235" but got code "535", with message "535-5.7.8 
Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/? 
p=BadCredentials j2-20020a654282000000b003fe28130b12sm5399227pgp.62 - gsmtp".". Authenticator 
"XOAUTH2" returned "Expected response code "235" but got code "334", with message "334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==".".`

Does anyone know how to send emails in laravel or a tutorial on doing it?有谁知道如何在 laravel 中发送电子邮件或有关如何发送电子邮件的教程? Thank you.谢谢你。

Follow this to generate new apps password and set your env file like this按照生成新的应用程序密码并像这样设置您的env文件

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=YOUR_GMAIL@gmail.com
MAIL_PASSWORD=YOUR_GENERATED_PASSWORD 
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

make sure your port and encryption setting is also changed in mail.php确保您的端口加密设置也在mail.php中更改

        '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,
    ],

you probably need to clear cache before test it out您可能需要在测试之前清除缓存

php artisan config:cache

暂无
暂无

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

相关问题 Laravel,无法使用 3 个可能的身份验证器使用用户名“”在 SMTP 服务器上进行身份验证 - Laravel, Failed to authenticate on SMTP server with username "" using 3 possible authenticators Laravel:无法使用 2 个可能的身份验证器在 SMTP 服务器上使用用户名进行身份验证 - Laravel :Failed to authenticate on SMTP server with username using 2 possible authenticators Laravel 无法使用用户名在 SMTP 服务器上进行身份验证 - Laravel Failed to authenticate on SMTP server with username 无法使用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 无法在 SMTP 服务器上进行身份验证 Laravel 6 - Failed to authenticate on SMTP server in Laravel 6 Swift_TransportException无法使用用户名在SMTP服务器上进行身份验证 - Swift_TransportException Failed to authenticate on SMTP server with username 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 google app smtp无法验证laravel 5.2 - google app smtp Failed to authenticate laravel 5.2 Laravel ZOHO SMTP Email 认证失败 - Laravel ZOHO SMTP Email failed to authenticate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM