【发布时间】:2021-06-17 10:22:57
【问题描述】:
我正在尝试使用 Laravel 6 从我的网络服务器发送邮件,如下所示:
Mail::send('feedback', ['email' => $email, 'text' => $text], function($message) use ($receiver)
{
$message->to($receiver, 'The receiver')->subject('New Feedback');
});
我根据谷歌的这个页面将我的登录信息添加到我的 .env 文件中:
https://support.google.com/mail/answer/7126229?hl=de
我的.env 文件:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=xxxx@gmail.com
MAIL_PASSWORD=my_gmail_login_password
MAIL_ENCRYPTION=tls
但我不断收到此错误消息:
Expected response code 250 but got code "530", with message "530-5.7.0 Authentication Required. Learn more at
530 5.7.0 https://support.google.com/mail/?p=WantAuthError
看起来我使用了错误的凭据,但我可以在 gmail 中使用这些凭据登录。
我还在我的 gmail 设置中启用了不安全的应用程序。
我还尝试通过创建应用密码并使用它而不是我的 gmail 密码来解决它。
没有任何效果。
有人知道我做错了什么吗?
【问题讨论】:
-
你能参考一下这个答案吗?:stackoverflow.com/a/56097125/6000629