![](/img/trans.png)
[英]Laravel, Failed to authenticate on SMTP server with username "" using 3 possible authenticators
[英]Failed to authenticate on SMTP server with username using Laravel Jetstream
我正在學習如何在使用 Laravel 8 更改系統角色時向用戶發送電子郵件,並且我遇到了這個問題,我正在遵循的大多數教程都需要 Google 帳戶打開不太安全的應用程序,但我無法更改設置在 Google 帳戶中不再顯示This setting is no longer available
。 我正在使用 Laravel 和 Jetstream。 以下是我得到的錯誤:
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==".".`
有誰知道如何在 laravel 中發送電子郵件或有關如何發送電子郵件的教程? 謝謝你。
按照此生成新的應用程序密碼並像這樣設置您的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}"
確保您的端口和加密設置也在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,
],
您可能需要在測試之前清除緩存
php artisan config:cache
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.