use*_*533 19 php gmail laravel
当我尝试通过运行Laravel 4的网站发送电子邮件时,我遇到了以下异常:
{"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\r\n535 5.7.8 http:\/\/support.google.com\/mail\/bin\/answer.py?answer=14257 y70sm14744455qgd.3 - gsmtp\r\n\"","file":"\/var\/www\/vendor\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/AbstractSmtpTransport.php","line":386}}
Run Code Online (Sandbox Code Playgroud)
这是我的邮件配置:
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,
);
Run Code Online (Sandbox Code Playgroud)
我试过通过谷歌搜索这个问题找到的禁用链接,除了它没有什么区别.
有没有办法告诉谷歌"停止阻止这个IP,这是我"?
Pat*_*ros 46
我尝试了同样的事情并得到了同样的错误.所以我亲自检查了我的Gmail帐户,我收到了Gmail发来的消息让我知道他们已阻止对我的电子邮件帐户的访问尝试.
他们通过访问https://www.google.com/settings/security/lesssecureapps显示了禁用此安全设置的选项.
tha*_*c89 27
转到此链接并停用解锁验证码 https://accounts.google.com/b/0/DisplayUnlockCaptcha
小智 11
https://www.google.com/settings/security/lesssecureapps并将其激活. https://accounts.google.com/b/0/DisplayUnlockCaptcha并将其激活.
'port'=> env('MAIL_PORT',587),
'encryption'=> env('MAIL_ENCRYPTION','tls'),
小智 5
我有很多问题无法找到答案。然后,经过大量的反复试验,我找到了解决方案。上面的大多数解决方案都适用于其他解决方案,但最多可以帮助我50%。
因此,这就是它对我的工作方式(100%):
在laravel中,转到.env文件并进行更改
MAIL_USERNAME= 'App Name you created'
MAIL_PASSWORD= 'Generated Password for that app'
Run Code Online (Sandbox Code Playgroud)
这应该能够从您的Gmail帐户发送电子邮件。如果不适合您,请发表评论。
| 归档时间: |
|
| 查看次数: |
49439 次 |
| 最近记录: |