邮件不工作。 Laravel

时间:2017-01-31 07:03:04

标签: php gmail laravel-5.2

我试图使用laravel的重置密码选项。我在路线中使用了Route::auth();。 我已将我的.env更改为以下内容:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemailaddress
MAIL_PASSWORD=myapppassword
MAIL_ENCRYPTION=tls

同样在我的mail.php文件中

 'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'myemailaddress', 'name' => 'Myname'],
   'username' => env('myemailaddress'),
'password' => env('myapppassword'),

当我从默认的resetpassword视图中单击resetpassword时,它会显示以下错误。

Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
#10060]

我无法弄清楚这里有什么不对。任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

您需要更新您的Gmail帐户,以允许“安全性较低的应用”通过您的帐户发送电子邮件。这可以做到:

https://www.google.com/settings/security/lesssecureapps