作者 邓超

x

@@ -1031,7 +1031,17 @@ class Imap { @@ -1031,7 +1031,17 @@ class Imap {
1031 if(!is_resource($this->socket)){ 1031 if(!is_resource($this->socket)){
1032 $this->timeout = $timeout ? : 30; 1032 $this->timeout = $timeout ? : 30;
1033 // 链接服务器 1033 // 链接服务器
1034 - $this->socket = @stream_socket_client($this->host, $errno, $error, $this->timeout); 1034 + $this->socket = stream_socket_client($this->host, $errno, $error, $this->timeout,STREAM_CLIENT_CONNECT,stream_context_create([
  1035 + 'ssl' => [
  1036 + 'verify_peer' => false, // 有的证书和域名不匹配,这里关闭认证
  1037 + 'verify_peer_name' => false,// 有的证书和域名不匹配,这里关闭认证
  1038 +// 'capture_peer_cert' => true,
  1039 +// 'capture_peer_cert_chain' => true,
  1040 +// 'SNI_enabled' => true,
  1041 +// 'SNI_server_name' => 'mail.laser-tech.com.cn'
  1042 +// 'allow_self_signed' => false
  1043 + ]
  1044 + ]));
1035 1045
1036 if($error){ 1046 if($error){
1037 throw new \Exception("socket error: {$error}"); 1047 throw new \Exception("socket error: {$error}");