原来一直使用的是 willcan 的代码,不过样式太简单,最近研究了一个新的代码,哈哈,功能强大很多

直接放在 function 里面就好了
//评论回复邮件 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 = 'no-reply@'%20<span%20style="color: #339933;">. preg_replace('#^www.#', '', strtolower($_SERVER['SERVER_NAME']));//发件人 e-mail 地址 $to = trim(get_comment($parent_id)->comment_author_email);$subject = '您在 ['%20<span%20style="color: #339933;">. get_option("blogname") . '] 的留言有了回應';$message = '<div style="background-color:#fff; border:1px solid #666666; color:#111;-moz-border-radius:8px; -webkit-border-radius:8px; -khtml-border-radius:8px;border-radius:8px; font-size:12px; width:702px; margin:0 auto; margin-top:10px;font-family: 微软雅黑, Arial;"><div style="background:#666666; width:100%; height:60px; color:white;-moz-border-radius:6px 6px 0 0; -webkit-border-radius:6px 6px 0 0;-khtml-border-radius:6px 6px 0 0; border-radius:6px 6px 0 0; "><span style="height:60px; line-height:60px; margin-left:30px; font-size:12px;"> 您在<a style="text-decoration:none; color:#00bbff;font-weight:600;"href="'%20<span%20style="color: #339933;">. get_option('home') . '">'%20<span%20style="color: #339933;">. get_option('blogname') . '</a> 博客上的留言有回复啦!</span></div><div style="width:90%; margin:0 auto"><p>'%20<span%20style="color: #339933;">. trim(get_comment($parent_id)->comment_author) . ', 您好!</p><p> 您曾在 ['%20<span%20style="color: #339933;">. get_option("blogname") . '] 的文章 《'%20<span%20style="color: #339933;">. get_the_title($comment->comment_post_ID) . '》 上发表评论:<p style="background-color: #EEE;border: 1px solid #DDD;padding: 20px;margin: 15px 0;">'%20<span%20style="color: #339933;">. nl2br(get_comment($parent_id)->comment_content) . '</p><p>'%20<span%20style="color: #339933;">. trim($comment->comment_author) . ' 给您的回复如下:<p style="background-color: #EEE;border: 1px solid #DDD;padding: 20px;margin: 15px 0;">'%20<span%20style="color: #339933;">. nl2br($comment->comment_content) . '</p><p> 您可以点击 <a style="text-decoration:none; color:#00bbff"href="'%20<span%20style="color: #339933;">. htmlspecialchars(get_comment_link($parent_id)) . '"> 查看回复的完整內容</a></p><p> 欢迎再次光临 <a style="text-decoration:none; color:#00bbff"href="'%20<span%20style="color: #339933;">. get_option('home') . '">'%20<span%20style="color: #339933;">. get_option('blogname') . '</a></p><p>(此邮件由系统自动发出, 请勿回复.)</p></div></div>';$from = "From: "" . get_option('blogname') . "" <$wp_email>";$headers = "$from Content-Type: text/html; charset=" . get_option('blog_charset') . " ";wp_mail( $to, $subject, $message, $headers );//echo 'mail to ', $to, '<br/> ' , $subject, $message; // for testing}}add_action('comment_post', 'comment_mail_notify');