当我尝试使用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