php - Laravel 无法使用 gmail 发送电子邮件

标签 php laravel gmail email

Expected response code 250 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/answer/14257 x201sm24123472qkx.32 - gsmtp

早上好,上面是我在laravel 5.2中尝试发送邮件的错误,我之前尝试过使用mailtrap检查它是否是代码,但它运行顺利,所以我怀疑问题是配置在 laravel .env 或邮件提供商端(在本例中为 gmail)的配置中,所以如果你能帮助我完成这项工作,我将非常感激

这是我的环境文件

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=my-account@gmail.com
MAIL_PASSWORD=my-password
MAIL_ENCRYPTION=tls

P.D.:在 gmail 中激活了安全性较低的应用

最佳答案

您发布的错误消息表明:

  1. 👍 Google 已成功且正确地接收到您发送电子邮件的尝试。
  2. 👎 Google 认为无论出于何种原因,您提供的凭据都是 Not Acceptable 。

URL 之后在错误消息中,谷歌有一些提示:

If you’re sure your password is right, try these tips:

  • If you've turned on 2-Step Verification for your account, you might need to enter an App password instead of your regular password.
  • Visit http://www.google.com/accounts/DisplayUnlockCaptcha and sign in with your Gmail username and password. If asked, enter the letters in the distorted picture.
  • Your app might not support the latest security standards. Try changing a few settings to allow less secure apps access to your account.
  • Change your password according to our tips on creating a strong password.

特别是,两步干扰或验证码可能是开始弄清楚 Google 为何不满意的好地方。没有人喜欢不开心的谷歌。

关于php - Laravel 无法使用 gmail 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39393692/

相关文章:

PHP:时间段,早上和晚上各多少时间?

php - 超时作业挂起 15 或 30 分钟,然后运行

php - 调用未定义的方法 Illuminate\Routing\RouteFileRegistrar::get() - 从 Laravel 5.7 升级到 5.8 后出错

java - GmailApi 快速入门 -

android - 如何防止在 Gmail 的集成迷你浏览器中打开链接

php - 用于 PHP 函数的 Eclipse PDT Intellisense

php - 这个 jQuery 不适用于 Mac,但适用于 Linux 和 Windows

php - 使用 ImageMagick 创建类似 placeit.net 的模型?

php - 无法让 Laravel 在 Ubuntu 上使用 apache

gmail - gmail oauth2 的授权码是否会过期