您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHPMailer在SAE上无法发送邮件的解决方法

2025/12/11 18:22:46发布40次查看
phpmailer在sae上无法发送邮件怎么回事呢,我们以前在php5.2.7版本中使用了phpmailer是可以发,但移到sae中发现无法发邮件了,那么此问题如何解决.
在sae上直接用5.2.7之前版本的phpmailer发送邮件会出现错误,原因在于phpmailer默认使用stream_socket_client()来建立socket,而sae禁用了这个函数,wordpress使用的就是5.2.7版本的phpmailer,因此也会出现同样的问题.
解决方法很简单,修改class.smtp.php(wordpress中是wp-includes/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);
//即可。 
最新的5.2.8版phpmailer已经解决了这个问题.
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product