Laravel 5.2:使用GMail发送邮件时出错

时间:2016-08-13 20:06:28

标签: php email laravel-5.2

我尝试使用Laravel 5.2(使用PHP 7.0.8和XAMPP)从localhost发送电子邮件,但是我收到此错误:

Swift_TransportException in StreamBuffer.php line 269:
Connection could not be established with host smtp.gmail.com [ #0]

我加载的邮件配置的值如下所示(使用Config :: get(" mail")):

  "driver" => "smtp"
  "host" => "smtp.gmail.com"
  "port" => "465"
  "from" => array:2 [
    "address" => "***@gmail.com"
    "name" => "MY_NAME"
  ]
  "encryption" => "ssl"
  "username" => "***@gmail.com"
  "password" => "***"
  "sendmail" => "C:\xampp\sendmail\sendmail.exe -bs"

我在最近几天用Google搜索了大约10个小时,但没有找到有效的解决方案。我还尝试更改"port" => "587""encryption" => "tls",但这也无效。错误是:

ErrorException in StreamBuffer.php line 95:
stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

在我的Google帐户中,我已经允许"不太安全的应用"。有什么我可以尝试的吗?

btw:使用PHP邮件功能,可以使用我的Gmail帐户发送电子邮件。

0 个答案:

没有答案