Php 在Laravel中注册时无法向用户发送电子邮件
我到处搜索,试图解锁我帐户中“不太安全的应用程序”,试图解锁capchat。但没有任何帮助。还有别的事要做吗 这将导致错误:Php 在Laravel中注册时无法向用户发送电子邮件,php,gmail,email,laravel-7,Php,Gmail,Email,Laravel 7,我到处搜索,试图解锁我帐户中“不太安全的应用程序”,试图解锁capchat。但没有任何帮助。还有别的事要做吗 这将导致错误: Failed to authenticate on SMTP server with username "my@gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with messag
Failed to authenticate on SMTP server with username "my@gmail.com" using 3 possible authenticators. 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
.env文件
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=MY-GMAIL@gmail.com
MAIL_PASSWORD=MY-PASSWORD
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=THE-SENDER-EMAIL@outlook.pt
MAIL_FROM_NAME="${APP_NAME}"
控制器类代码
public function build()
{
return $this
->subject('Your account created with success!')
->replyTo('MY-REPLY-MAIL@outlook.pt')
->view('emails.user-registered')
->with(['user' => $this->user]);
}
我只是在发帖子,也许有人会需要它。 我解决了打开我帐户中不太安全的应用程序的问题 我把密码用双引号引起来
我希望它能帮助其他人。检查您的电子邮件是否启用了2步验证?2步已关闭。我应该打开它吗?让我们一步一步地调试它。访问下面的链接,只需打开设置(如果它关闭):我已经做了,没有工作。“不太安全的应用”否,您已启用“不太安全的应用”设置。