择使用带系统验证的SMTP邮箱(邮箱支持SMTP协议的邮箱)来作为网站的系统邮件发送方式。
安装插件就在WordPress后台直接插件搜索smtp,然后可以在SMTP,Configure SMTP,WP-Mail-SMTP选择一个安装启用再配置一下对应的参数就可以使用了!
插件:SMTP配置实例
Configure SMTP 配置实例
不安装插件的方法:直接把邮箱的参数写在文件/wp-includes/class-phpmailer.php和/wp-includes/pluggable.php 里面
Windows自带记事本默认会用asii编码,WordPress的是UTF8编码,容易出现乱码!所以推荐用EditPlus或者Notepad++编辑器!
打开/wp-includes/class-phpmailer.php填写你的邮箱的SMTP地址、邮箱名称、邮箱密码、发送端口等。
在文件中找到下面几项进行修改对应的值!
var $Mailer = ‘smtp’; //设置发现方式为smtp
var $Host = ‘smtp.qq.com’; //邮箱的SMTP服务器地址
var $Port = 465; //SMTP邮件发送端口。一般默认为25。示例是开启了ssl填的465
var $SMTPSecure = “ssl”; //是否验证 ssl或tls
var $SMTPAuth = true; //开启SMTP
var $Username = ’邮箱地址’; //你的邮箱地址
var $Password = ‘密码’; //你的邮箱登陆密码
然后再修改过/wp-includes/pluggable.php把$phpmailer->IsMail(); 替换为:$phpmailer->IsSMTP();
如果图方便干脆可以直接在class-phpmailer.php把 $this->Mailer = 'mail';改成 $this->Mailer = 'smtp';
附常用邮件SMTP参数及FAQ:
腾讯邮箱 @qq.com @foxmail.com 以及域名邮箱企业邮箱
smtp.qq.com
默认端口:25
SSL加密连接端口:465或587
官方FAQ:http://service.mail.qq.com/cgi-bin/help?subtype=1&&no=369&&id=28
官方FAQ:http://service.mail.qq.com/cgi-bin/help?subtype=1&&no=166&&id=28
Google Mail @gmail.com 以及apps服务的企业邮箱
smtp.gmail.com
SSL加密连接端口:465
TLS/STARTTLS端口:587
官方FAQ:http://mail.google.com/support/bin/answer.py?hl=zh-Hans&answer=13287
新浪邮箱 @sina.com @vip.sina.com
收费SMTP:smtp.vip.sina.com
免费邮箱SMTP:smtp.sina.com.cn
官方FAQ:http://mail.sina.com.cn/help2/client01.html
网易163邮箱 @163.com @126.com
SMTP地址:smtp.163.com
默认端口:25
SSL加密连接端口:465或994
163官方FAQ:http://help.163.com/09/1223/14/5R7P3QI100753VB8.html
163官方FAQ:http://help.163.com/10/0312/13/61J0LI3200752CLQ.html
126官方FAQ:http://www.126.com/help/client_04.htm