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 中激活了安全性较低的应用
最佳答案
您发布的错误消息表明:
- 👍 Google 已成功且正确地接收到您发送电子邮件的尝试。
- 👎 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/