本文介绍了预期响应代码 250,但得到代码“535",消息“535-5.7.8 不接受用户名和密码"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在尝试通过 gmail 发送邮件时遇到了 SwiftMail 错误.

I recently encountered a SwiftMail error while trying to send a mail through gmail.

 Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted.

我试图通过我的 gmail 发送邮件,而 google 认为我是垃圾邮件(可能是因为我的请求太快了)我收到了一封来自他们的邮件,说我的帐户可以访问,我告诉他们是我.我能够毫无问题地发送邮件,而且它现在才发生.

I was trying to send mail through my gmail and google thought that I was a spam(maybe because I was requesting too fast) I received a mail from them saying my account was access and I told them it was me. I was able to send mail without problem and it just occured now.

这是我的 env 文件的内容.

This is the contents of my env file.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=mypasswordhere
[email protected]
MAIL_NAME=talentscout

推荐答案

我在互联网上进行了研究,一些答案包括启用访问较小的应用程序"和解锁 gmail 验证码",遗憾的是,在我找到两步验证之前,它对我不起作用.

I researched on the internet and some answers includes enabling the "access for lesser app" and "unlocking gmail captcha" which sadly didn't work for me until I found the 2-step verification.

我做了以下事情:

  1. 启用两步验证到谷歌这里

创建供您的系统使用的应用密码此处

Create App Password to be use by your system HERE

我选择了Others(自定义名称)并点击了生成

转到我在 laravel 中的 env 文件并编辑了这个

Went to my env file in laravel and edited this

[email protected]

[email protected]

MAIL_PASSWORD=生成的密码

MAIL_PASSWORD=thepasswordgenerated

这是我的解决方案.我创建它是为了至少让其他人不会浪费时间研究可能的答案.

This was my solution. I created this to atleast make other people not go wasting their time researching for a possible answer.

这篇关于预期响应代码 250,但得到代码“535",消息“535-5.7.8 不接受用户名和密码"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 01:34