Gmail通过Laravel发送邮件时锁定帐户 [英] Gmail locks account when sending mail via Laravel
问题描述
当我尝试通过运行Laravel 4的网站发送电子邮件时,出现以下异常:
预期响应代码250但是获得了代码535,并且消息535-5.7.8
用户名和密码未被接受。请参阅535 5.7.8
http://support.google.com/mail/bin/answer.py?answer=14257
wd7sm12843789wjc。 36 - gsmtp
以下是我的邮件配置:
return array($ b $'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'=> fal se,
);
我第一次收到这封邮件时,不得不告诉Google他可以信任这个IP。但是我在我的网站上仍然存在这个问题,Google不会再发出警告。
有没有办法告诉Google停止阻止这个IP,这是我的
自从我发布这个问题后,我找到了解决这个问题的方法。
我为我的Google帐户启用了两步验证。然后,我为我的Gmail帐户生成了一个特定于应用程序的密码,并将该密码放入我的Laravel应用程序中。
现在Laravel可以通过我的Gmail帐户发送电子邮件:)
When I try to send an e-mail through my website running Laravel 4, I get this exception:
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 wd7sm12843789wjc.36 - gsmtp "
Here is my mail config:
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,
);
The first time I got this message, I had to tell Google that he can trust this IP. But I'm still having this issue on my website and Google doesn't warn me anymore.
Is there a way to tell Google "stop blocking this IP, it's me" ?
Since I posted this question, I found a way to solve this issue.
I activated 2-steps authentication for my Google account. Then I generated an application-specific password for my Gmail account and I put this password into my Laravel application.
Now Laravel can send e-mails through my Gmail account :)
这篇关于Gmail通过Laravel发送邮件时锁定帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!