Deployment without plug-ins Send comments to emails via SMTP
add_action('phpmailer_init', 'mail_smtp');
function mail_smtp( $phpmailer ) {
$phpmailer->IsSMTP();
$phpmailer->Host = "smtp.qq.com"; //SMTP服务器地址,在邮箱设置或者帮助中心中可以找到
$phpmailer->Port = 465; //SMTP端口,常用端口有:25、465和587(后两个为ssl端口)。
$phpmailer->Username = "[email protected]"; //邮箱的登录账号
$phpmailer->Password = "*******"; //邮箱的登录密码 QQ邮箱为SMTP的授权码
$phpmailer->SMTPAuth = true; //启用SMTP认证
$phpmailer->SMTPSecure = 'ssl'; //SMTP加密方式(是否通过 ssl 连接,如果端口为25,则此处将"ssl"改为空白即"",否则不必改动)
$phpmailer->From = "[email protected]"; //发件人的地址(建议与登录帐号保存一致,不一致会邮箱会显示代发)
$phpmailer->FromName = "发件人姓名"; //发件人的称呼
$phpmailer->addAddress('收件邮箱');
}
Copy the above code to the theme file function.php and change the parameters according to your own situation
2. Use the WP SMTP plug-in to deploy the message comment SMTP and send it to the mailbox
WP SMTP download address: https://cn.wordpress.org/plugins/wp-smtp/
After installing and starting the plug-in, fill in your email address as shown below
Tip: If you use QQ mailbox, please make sure that your mailbox has turned on the STMP service.
1. Open the STMP service of QQ mailbox as follows