/* comment_mail_notify v1.0 by willin kan. (無勾選欄) */ 
function comment_mail_notify($comment_id) { 
$admin_email = get_bloginfo ('admin_email'); // $admin_email 可改為你指定的 e-mail. 
$comment = get_comment($comment_id); 
$comment_author_email = trim($comment->comment_author_email); 
$parent_id = $comment->comment_parent ? $comment->comment_parent : ''; 
$to = $parent_id ? trim(get_comment($parent_id)->comment_author_email) : ''; 
$spam_confirmed = $comment->comment_approved; 
if (($parent_id != '') && ($spam_confirmed != 'spam') && ($to != $admin_email) && ($comment_author_email == $admin_email)) { 
/* 下面的判斷式,決定發出郵件的必要條件: 
($parent_id != '') && ($spam_confirmed != 'spam'): 回覆的, 而且不是 spam 才可發, 必须!! 
($to != $admin_email) : 不發給 admin. 
($comment_author_email == $admin_email) : 只有 admin 的回覆才可發. 
可視個人需要修正以上條件. 
*/ 
$wp_email = '[email protected]' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); // e-mail 發出點, no-reply 可改為可用的 e-mail. 
$subject = '您在【' . get_option("blogname") . '】的留言有回复了!去看看吧 ^_^'; 
$message = ' 
<p style="margin: 1em 40px 1em 40px;background-color:#eef2fa;border:1px solid #d8e3e8;color:#111;padding: 0 15px;-moz-border-radius:5px;-webkit-border-radius:5px;-khtml-border-radius:5px;border-radius:5px;"> 
<p>Hi !<strong>' . trim(get_comment($parent_id)->comment_author) . '</strong>,您好! 
您曾在<strong>《' . get_the_title($comment->comment_post_ID) . '》</strong>的留言有了新回复。</p></p> 
<p style="margin: 1em 40px 1em 40px;background-color:#eef2fa;border:1px solid #d8e3e8;color:#111;padding: 0 15px;-moz-border-radius:5px;-webkit-border-radius:5px;-khtml-border-radius:5px;border-radius:5px;"><p><strong> 
您</strong>说:' . trim(get_comment($parent_id)->comment_content) . '</p> 
<p><strong>' . trim($comment->comment_author) . '</strong>说: 
' . trim($comment->comment_content) . '</p> 
<p>您能够点击<a href="' . htmlspecialchars(get_comment_link($parent_id)) . '">查看完好的回复內容。</a></p> 
<p>欢送再度莅临 <a href="' . get_option('home') . '">' . get_option('blogname') . '</a></p> 
<p>(此邮件由零碎主动发送,请勿回复。)</p></p> 
'; 
$from = "From: \"" . get_option('blogname') . "\" <$wp_email>"; 
$headers = "$from\nContent-Type: text/html; charset=" . get_option('blog_charset') . "\n"; 
wp_mail( $to, $subject, $message, $headers ); 
echo 'mail to ', $to, ' 
' , $subject, $message; // for testing 
} 
} 
add_action('comment_post', 'comment_mail_notify'); 
// -- END ---------------------------------------- 
以上就是安达网络工作室关于《WordPress评论邮件通知无插件实现思路及代码》的一些看法。更多内容请查看本栏目更多内容!
本文实例讲述了WordPress增加前台注册性能的办法。分享给大家供大家参考。详细剖析如下: WordPress属于集体...
WordPress是支流的 Blog 搭建平台。 WordPress 能够说是世界上目前最先进的 weblog 顺序。目前开发的顺...
第一种办法:我的这个博客不断都在网上运转,明天想把它在本地架设一个,包括数据库都和网上的如出一辙。详...
咱们都晓得,wordpress默许状况下会主动跳转到后盾规则的home_url下来,例如你的空间同时绑定了jb51.net和w...
WordPress 3.5 新增加了一个提醒框性能,能够创立一个提醒框,而后指向任何元素,比方下边的例子: 本文就...
本文实例讲述了WordPress屏蔽评论中链接地址的办法。分享给大家供大家参考。详细剖析如下: 应用WordPress做...