1、去QQ或163邮箱,开通SMTP发信权限
2、获取密匙
3、主题的function.php文件加入以下代码(以下以QQ邮箱的SMTP发信为例)
1 2 3 4 5 6 7 8 9 10 11 12 13 | //使用smtp发送邮件(请根据自己使用的邮箱设置SMTP) add_action('phpmailer_init', 'mail_smtp'); function mail_smtp( $phpmailer ) { $phpmailer-> FromName = '某某某'; //发件人 $phpmailer-> Host = 'smtp.qq.com'; //修改为你使用的SMTP服务器 $phpmailer-> Port = 465; //SMTP端口,开启了SSL加密 $phpmailer-> Username = 'xxxxx@qq.com'; //邮箱账户(你邮箱地址) $phpmailer-> Password = 'xxxxx'; //输入密匙(开通SMTP发信后,可以获取密匙) $phpmailer-> From = 'xxxxx@qq.com'; //对方接收邮件时,显示的邮箱地址(一般填你自己的邮箱地址) $phpmailer-> SMTPAuth = true; $phpmailer-> SMTPSecure = 'ssl'; //tls or ssl (port=25留空,465则填写ssl) $phpmailer-> IsSMTP(); } |
原文链接:https://xiaohost.com/5080.html,转载请注明出处。
评论0