报错:
- Connection could not be established with host hwsmtp.exmail.qq.com [ #0]
复制代码
原因:
laravel5默认使用的是 swiftmailer 扩展。发送使用的是 stream 其中并未对ssl提供证书等内容配置,所以当使用ssl时又未指定证书时会错
解决:
\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php
搜索
- $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options));
复制代码
上面加上
- //在这里增加代码,修改默认值
- $options['ssl']['verify_peer_name'] = FALSE;
复制代码
保存替换同名文件,故障解决 |