燕语呢喃

  • 首页
  • 目录
  • 说说
    • 网站
    • 字体
    • 灯火阑珊
    • 软件
    • 唠叨
    • *素问
    • 摄影
  • 留言板
  • 关于
    • 隐私政策
  • 管理
燕语呢喃
彭纪雁的个人博客
  1. 首页
  2. 网站
  3. 正文

万网空间 WordPress不支持smtp解决方法

2015年4月3日 5012点热度 0人点赞 0条评论
<blockquote>

WordPress在万网空间无法发送邮件的解决办法

WordPress默认使用的是stream_socket_client函数发送邮件,而万网空间却支持的是fsockopen函数,所以在万网虚拟主机上,安装wordpress 默认安装smtp插件,是无法发送邮件。

解决办法:

找到wp-includes文件夹里面的class-smtp.php文件, 搜索stream_socket_client字段(大约202行)。找到如下代码

[cce_php]
$this->smtp_conn = @stream_socket_client(
$host . “:” . $port,
$errno,
$errstr,
$timeout,
STREAM_CLIENT_CONNECT,
$socket_context
);
[/cce_php]

 

 

注释掉这段话。如下所示:

[cce_php]
/*
$this->smtp_conn = @stream_socket_client(
$host . “:” . $port,
$errno,
$errstr,
$timeout,
STREAM_CLIENT_CONNECT,
$socket_context
);
*/
[/cce_php]

接着在这段代码的上一行添加如下代码

[cce]$this->smtp_conn = fsockopen($host, $port, $errno, $errstr);[/cce]

修改好的代码如下所示:

// Connect to the SMTP server
$errno = 0;
$errstr = ”;
$socket_context = stream_context_create($options);
//Suppress errors; connection failures are handled at a higher level
$this->smtp_conn = fsockopen($host, $port, $errno, $errstr);
/*
$this->smtp_conn = @stream_socket_client(
$host . “:” . $port,
$errno,
$errstr,
$timeout,
STREAM_CLIENT_CONNECT,
$socket_context
);
*/

</blockquote>

标签: 暂无
最后更新:2015年4月3日

admin

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

admin

这个人很懒,什么都没留下

最新 热点 随机
最新 热点 随机
咏柳 路由笔记 尽头 coreldraw 备忘录 专业字体设计软件FontCreator 12.0中文汉化专业版 旧榻鹅群帖
尽头 不好的预感. ···· 备注 快速提升WordPress速度的方法 一路走好···
分类
  • *素问
  • PS插件
  • 台北故宫博物院
  • 唠叨
  • 女儿
  • 字体
  • 摄影
  • 未分类
  • 柴米油盐
  • 灯火阑珊
  • 网站
  • 说说
  • 软件

COPYRIGHT © 2023 燕语呢喃. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang