wordpress在主题中配置邮箱,不用任何插件

//使用smtp发邮件
function MBT_mail_smtp( $phpmailer ) {
 $phpmailer->IsSMTP();
 $phpmailer->SMTPAuth = true;//启用SMTPAuth服务
 $phpmailer->Port = 465;//MTP邮件发送端口,这个和下面的对应,如果这里填写25,则下面为空白
 $phpmailer->SMTPSecure ="ssl";//是否验证 ssl,这个和上面的对应,如果不填写,则上面的端口须为25
 $phpmailer->Host = "smtp.qq.com";//邮箱的SMTP服务器地址,如果是QQ的则为:smtp.exmail.qq.com
 $phpmailer->Username = "jwzyw@qq.com";//你的邮箱地址
 $phpmailer->Password ="mxbgsogbhyztde";//你的邮箱登录密码
}
add_action('phpmailer_init', 'MBT_mail_smtp');
//下面这个很重要,得将发件地址改成和上面smtp邮箱一致才行。
function MBT_wp_mail_from( $original_email_address ) {
 return 'jwzyw@qq.com';
}
add_filter( 'wp_mail_from', 'MBT_wp_mail_from' );

  • 版权声明:所有资源均来源于互联网,如有侵权请联系我们删除
  • 发表,

  • 转载请注明:wordpress在主题中配置邮箱,不用任何插件 | 「多佳科博客」
  • (0)
    多佳科多佳科
    上一篇 2024年6月20日
    下一篇 2025年5月21日

    相关推荐