Laravel Gmail 不工作,“用户名和密码不被接受.了解更多..."

2022-01-23 00:00:00 gmail php laravel

当我尝试通过运行 Laravel 4 的网站发送电子邮件时,我收到以下异常:

When I try to send an e-mail through my website running Laravel 4, I get this exception:

{"error":{"type":"Swift_TransportException","message":"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 http://support.google.com/mail/bin/answer.py?answer=14257 y70sm14744455qgd.3 - gsmtp
"","file":"/var/www/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php","line":386}}

这是我的邮件配置:

return array(
  'driver' => 'smtp',
  'host' => 'smtp.gmail.com',
  'port' => 465,
  'from' => array('address' => 'mymail@gmail.com', 'name' => 'myname'),
  'encryption' => 'ssl',
  'username' => 'mymail@gmail.com',
  'password' => 'lol',
  'sendmail' => '/usr/sbin/sendmail -bs',
  'pretend' => false,
);

我已经尝试了通过谷歌搜索这个问题找到的禁用链接,但它没有任何区别.

I've tried the disable link i've found by googling this issue except it didn't make a difference.

有没有办法告诉谷歌停止屏蔽这个 IP,是我"?

Is there a way to tell Google "stop blocking this IP, it's me" ?

推荐答案

我尝试了同样的事情,得到了同样的错误.所以我亲自检查了我的 gmail 帐户,我收到了来自 Gmail 本身的消息,让我知道他们阻止了对我的电子邮件帐户的访问尝试.

I tried the same thing and got the same error. So i personally checked my gmail account and i had a message from Gmail itself letting me know that they'd blocked an access attempt to my email account.

他们通过访问 https 显示了禁用此安全设置的选项://www.google.com/settings/security/lesssecureapps.

如果您访问已经登录到您的 Gmail 帐户的链接,事情实际上会更直接.

Things will actually be more straight forward if you visit that link already logged in into your Gmail account.

相关文章