比较实用的WordPress评论邮件自动通知功能。主要的目的在于提高回访性。如果有朋友去你的网站咨询问题,但是过后他可能忘记这回事,有可能就不了了之了,这时候有邮件回复通知就不会让他错过了。,实现评论邮件自动通知的功能只要把以下代码添加到functions.php即可,此方法仅限于Linux主机使用。,
比较实用的WordPress评论邮件自动通知功能。主要的目的在于提高回访性。如果有朋友去你的网站咨询问题,但是过后他可能忘记这回事,有可能就不了了之了,这时候有邮件回复通知就不会让他错过了。
实现评论邮件自动通知的功能只要把以下代码添加到functions.php即可,此方法仅限于Linux主机使用。
//评论邮件自动通知 function comment_mail_notify($comment_id) { $admin_email = get_bloginfo ('admin_email'); $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)) { $wp_email = 'no-reply@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); $subject = '您在 [' . get_option("blogname") . '] 的评论有新的回复'; $message = ''; $message = convert_smilies($message); $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 ); } } add_action('comment_post', 'comment_mail_notify');' . trim(get_comment($parent_id)->comment_author) . ', 您好!
您曾在 [' . get_option("blogname") . '] 的文章 《' . get_the_title($comment->comment_post_ID) . '》 上发表评论:
'
. nl2br(get_comment($parent_id)->comment_content) . '' . trim($comment->comment_author) . ' 给您的回复如下:
'
. nl2br($comment->comment_content) . '您可以点击 查看回复的完整內容
欢迎再次光临 ' . get_option('blogname') . '
(此邮件由系统自动发出,请勿回复。)
,
比较实用的WordPress评论邮件自动通知功能。主要的目的在于提高回访性。如果有朋友去你的网站咨询问题,但是过后他可能忘记这回事,有可能就不了了之了,这时候有邮件回复通知就不会让他错过了。
实现评论邮件自动通知的功能只要把以下代码添加到functions.php即可,此方法仅限于Linux主机使用。
//评论邮件自动通知 function comment_mail_notify($comment_id) { $admin_email = get_bloginfo ('admin_email'); $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)) { $wp_email = 'no-reply@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); $subject = '您在 [' . get_option("blogname") . '] 的评论有新的回复'; $message = ''; $message = convert_smilies($message); $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 ); } } add_action('comment_post', 'comment_mail_notify');' . trim(get_comment($parent_id)->comment_author) . ', 您好!
您曾在 [' . get_option("blogname") . '] 的文章 《' . get_the_title($comment->comment_post_ID) . '》 上发表评论:
'
. nl2br(get_comment($parent_id)->comment_content) . '' . trim($comment->comment_author) . ' 给您的回复如下:
'
. nl2br($comment->comment_content) . '您可以点击 查看回复的完整內容
欢迎再次光临 ' . get_option('blogname') . '
(此邮件由系统自动发出,请勿回复。)
此处评论已关闭