wordpress默认的发邮件方式是通过mail函数,可这样很容易被很多邮箱屏蔽,替换成smtp方式发送,不仅防止了屏蔽,也便于查看发送了哪些邮件以及发送状态。
方法一:使用插件
使用WP SMTP插件:http://wordpress.org/extend/plugins/wp-smtp/
方法二:在主题functions.php中添加代码
function mail_smtp($phpmailer){
$phpmailer->IsSMTP();
$phpmailer->SMTPAuth = true; //启用SMTPAuth服务
$phpmailer->Port = 465; //SMTP邮件发送端口,这个和下面的对应,如果这里填写25,则下面为空白
$phpmailer->SMTPSecure = “ssl”; //是否验证 ssl,这个和上面的对应,如果不填写,则上面的端口须为25
$phpmailer->Host = “smtp.163.com”; //邮箱的SMTP服务器地址
$phpmailer->Username = “*****@163.com”; //邮箱地址
$phpmailer->Password = “*******”; //邮箱密码
}
add_action(‘phpmailer_init’,'mail_smtp’);
以后邮件回复设置中的变量wp_email要和上面的Username一致。
方法三:修改wp-includes目录下的pluggable.php和class-phpmailer.php文件(仅适用于WP3.0以上版本)
(1) 在pluggable.php中搜索如下代码
$phpmailer->IsMail();
替换为:
$phpmailer->IsSMTP();
(2) 在class-phpmailer.php中配置如下信息:
var $Mailer = ‘smtp’;
var $Host = ‘smtp.163.com’; //邮箱的SMTP服务器地址
var $Port = 465; //SMTP邮件发送端口。一般默认为25,示例用的是465
$SMTPSecure = “ssl”; //是否验证ssl
$SMTPAuth = true; //开启SMTP
$Username = ‘xxxx@163.com’; //邮箱地址
var $Password = ‘******’; //邮箱密码
-
近期文章
近期评论
文章归档
- 2014 年八月
- 2014 年七月
- 2014 年六月
- 2014 年五月
- 2014 年四月
- 2014 年三月
- 2014 年二月
- 2014 年一月
- 2013 年十二月
- 2013 年十一月
- 2013 年十月
- 2013 年九月
- 2013 年八月
- 2013 年七月
- 2013 年六月
- 2013 年五月
- 2013 年四月
- 2013 年三月
- 2013 年二月
- 2013 年一月
- 2012 年十二月
- 2012 年十一月
- 2012 年九月
- 2012 年八月
- 2012 年七月
- 2012 年六月
- 2012 年五月
- 2012 年四月
- 2012 年三月
- 2012 年二月
- 2012 年一月
- 2011 年十二月
- 2011 年十一月
- 2011 年十月
- 2011 年七月
- 2011 年六月
- 2011 年五月
- 2008 年十一月
- 2008 年十月
- 2008 年九月
- 2008 年八月
- 2008 年七月
- 2008 年六月
- 2008 年五月
- 2008 年四月
- 2008 年三月
- 2008 年二月
- 2008 年一月
分类目录
功能