Reply email to the comment authors email in wordpress
How to implement Reply email to the comment authors email in WordPress ? Its the most required functionality that missing in WordPress ? .The important of email reply for a comment is very important in WordPress sometimes a visitor commented in your site and when you reply to that comment in the site. Normally WordPress do not send a notification email to the comment authors.
So how we can achieve this in WordPress its just simple just edit a single file and achieve your task. Here i just explain How to sent reply email to the comment authors email in WordPress specially HTML email with custom template.
First you have to create a custom email template for reply email to the comment authors email. Something like in the picture just create an HTML file and have basic place holders like above. Create the HTML file as email_temp.html and copy the files to your wp-includes. Then you have to open wp-comments-post.php in the root of your WordPress installation. and search for the following function name.
wp_new_comment( $commentdata );
Then you have to paste the following codes just below that.
if($comment_parent > 0 ){
$fp = fopen(ABSPATH . WPINC ."/email_tmpl.html","r");
$fsize = filesize(ABSPATH . WPINC ."/email_tmpl.html");
$content = fread($fp,$fsize);
fclose($fp);
$permalink_parent_comment = get_permalink( $post->ID );
$comment_parent_details = get_comment( $comment_parent );
$date = date("M d Y");
$content = str_replace("{date}",$date,$content);
$greeting_text = "Hai ".$comment_parent_details->comment_author.",";
$content = str_replace("{greeting_text}",$greeting_text,$content);
$comment_content_response = $commentdata['comment_content']."<br/> Click <a href='".$permalink_parent_comment."'>here</a> view in details";
$content = str_replace("{email_content}",$comment_content_response,$content);
$content = str_replace("{thanks_text}","Thanks & Regards <br/> Walkswithme.net",$content);
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
// More headers
$headers .= "From: ".$commentdata['comment_author']."<".$commentdata['comment_author_email'].">"."\r\n";
$headers .= 'Reply-To: jobinjose01@walkswithme.net' . "\r\n";//replace with your blog email
$to = $comment_parent_details->comment_author_email;
$subject = "YOUR COMMENT RESPONSE at Walkswithme.net" ;
$message = $content;
mail($to,$subject,$message,$headers);
}
Just see the magic of reply email to the comment authors email in WordPress. One thing you have to keep in mind its a WordPress core file edit so you should keep this section as a brief note. Then only you can go with WordPress update.
Enjoy WordPress reply email to the comment authors email. 🙂 🙂 🙂
One thought on “Reply email to the comment authors email in wordpress”
you guyz make me crazy lol