當我嘗試使用Gmail的SMTP通過Laravel發送電子郵件,我會遇到以下錯誤:通過Laravel爲使用Gmail SMTP:連接無法與主機smtp.gmail.com建立[連接超時#110]
Swift_TransportException
Connection could not be established with host smtp.gmail.com [Connection timed out #110]
這是錯誤的軌跡:
...
}
$this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options));
if (false === $this->_stream) {
throw new Swift_TransportException(
'Connection could not be established with host ' . $this->_params['host'] .
' [' . $errstr . ' #' . $errno . ']'...
,這裏是我的郵件配置:
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => array('address' => '[email protected]', 'name' => 'some'),
'encryption' => 'tls',
'username' => '[email protected]',
'password' => 'mypassword',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false
我使用共享主機,並且localhost上的端口587已打開。
你用Gmail的smtp?那麼我認爲司機應該是smtp,不是? – Ahmad 2015-01-23 18:18:43
這是通過,但**電子郵件**不發送。 – ihue 2015-11-10 13:20:46
我在哪裏可以找到這些配置? – mr5 2016-02-09 07:51:25