1.用FTP打開 /wp-include/class-smtp.php ,最好是下載下來,搜索一下,查找到如下的代碼:
- $this->smtp_conn?=?@stream_socket_client(
- $host?.?":"?.?$port,
- $errno,
- $errstr,
- $timeout,
- STREAM_CLIENT_CONNECT,
- $socket_context
- );
注釋掉,然后添加代碼:
- $this->smtp_conn?=?fsockopen($host,?$port,?$errno,?$errstr);
?
2、如果是PHP5.6.X的版本,那么可能會有報錯:
SSL3_GET_SERVER_CERTIFICATE:certificate verify failed?
PHP5.6會默認開啟SSL驗證,所以需要
在php.ini中增加一行
1 | openssl.cafile=/etc/pki/tls/certs/ca-bundle.crt |
重啟服務器使修改生效