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年8月
- 2014年7月
- 2014年6月
- 2014年5月
- 2014年4月
- 2014年3月
- 2014年2月
- 2014年1月
- 2013年12月
- 2013年11月
- 2013年10月
- 2013年9月
- 2013年8月
- 2013年7月
- 2013年6月
- 2013年5月
- 2013年4月
- 2013年3月
- 2013年2月
- 2013年1月
- 2012年12月
- 2012年11月
- 2012年9月
- 2012年8月
- 2012年7月
- 2012年6月
- 2012年5月
- 2012年4月
- 2012年3月
- 2012年2月
- 2012年1月
- 2011年12月
- 2011年11月
- 2011年10月
- 2011年7月
- 2011年6月
- 2011年5月
- 2008年11月
- 2008年10月
- 2008年9月
- 2008年8月
- 2008年7月
- 2008年6月
- 2008年5月
- 2008年4月
- 2008年3月
- 2008年2月
- 2008年1月
分类
其他操作