//评论回复邮件
function comment_mail_notify($comment_id){
$comment = get_comment($comment_id);
$parent_id = $comment->comment_parent ? $comment->comment_parent : '';
$spam_confirmed = $comment->comment_approved;
if(($parent_id != '') && ($spam_confirmed != 'spam')){
$wp_email = 'webmaster@' . preg_replace('#^www.#', '', strtolower($_SERVER['SERVER_NAME']));
$to = trim(get_comment($parent_id)->comment_author_email);
$subject = '你在 [' . get_option("blogname") . '] 的留言有了回应';
$message = '
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: solid; border-width: 1;" bordercolor="#85C1DF" width="700" height="251" id="AutoNumber1" align="center">
<tr>
<td width="520" height="28" bgcolor="#F5F9FB"><font color="#1A65B6" style="font-size:14px"> <b>留言回复通知 | <a href="http://wangqingzi.com" targe="blank">王庆资的部落格</a></b></font></td>
</tr>
<tr>
<td width="800" height="210" bgcolor="#FFffff" valign="top" style=" padding:8px;"> <span class="STYLE2"><strong >' . trim(get_comment($parent_id)->comment_author) . '</strong>, 你好!</span>
<p> <span class="STYLE2">你曾在《' . get_the_title($comment->comment_post_ID) . '》的留言:<br /> --->'
. trim(get_comment($parent_id)->comment_content) . '<br /><br />
' . trim($comment->comment_author) . ' 给你的回复:<br /> --->'
. trim($comment->comment_content) . '</span></p>
<p > <Strong>你可以点击 <a href="' . htmlspecialchars(get_comment_link($parent_id)) . '">查看回复完整内容</a></Strong></p>
</td>
</tr>
</table>';
$from = "From: "" . get_option('blogname') . "" <$wp_email>";
$headers = "$fromnContent-Type: text/html; charset=" . get_option('blog_charset') . "n";
wp_mail( $to, $subject, $message, $headers );
}
}
add_action('comment_post', 'comment_mail_notify');