会员仅9.9元起,全站资源无限制ALL免费下载!

7B2主题美化-添加邮箱功能

文章最后更新时间:2025-11-13 18:23:56

b2/functions.php文章源自奇客源码-https://www.qkget.cn/5933.html

//使用smtp发邮件
function mail_smtp( $phpmailer ) {
$phpmailer->IsSMTP();
$phpmailer->SMTPAuth = true;//启用SMTPAuth服务
$phpmailer->Port = 465;//SMTP邮件发送端口,这个和下面的对应,如果这里填写25,则下面为空白
$phpmailer->SMTPSecure ="ssl";//是否验证 ssl,这个和上面的对应,如果不填写,则上面的端口须为25
$phpmailer->Host = "smtp.qq.com";//邮箱的SMTP服务器地址,如果是QQ的则为:smtp.exmail.qq.com
$phpmailer->Username = "*****@qq.com";//你的邮箱地址
$phpmailer->Password ="***********";//你的邮箱登陆密码
}
add_action("phpmailer_init", "mail_smtp");
function ashuwp_wp_mail_from( $original_email_address ) {
return "*****@qq.com";//这个很重要,得将发件地址改成和上面smtp邮箱一致才行
}
add_filter( "wp_mail_from", "ashuwp_wp_mail_from" );
//邮件smtp设置
function mail_smtp($phpmailer)
{
    $phpmailer->IsSMTP();
    $phpmailer->FromName   = '发件人名称';
    $phpmailer->Host       = 'smtp.qq.com'; // 邮件服务器地址
    $phpmailer->Port       = '465'; // 端口
    $phpmailer->Username   = '88888888@qq.com'; // 邮箱账号
    $phpmailer->Password   = '123456789'; // 服务密码
    $phpmailer->From       = '88888888@qq.com'; // 发信人邮箱账号
    $phpmailer->SMTPAuth   = true; // SMTPAuth服务
    $phpmailer->SMTPSecure = 'ssl'; // 加密方式(SMTPSecure)
}
add_action('phpmailer_init', 'mail_smtp');

二选一文章源自奇客源码-https://www.qkget.cn/5933.html

文章源自奇客源码-https://www.qkget.cn/5933.html
© 版权声明
THE END
点赞8赞赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容