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.

Reply email to the comment authors email in WordPress
Reply email to the comment authors email in WordPress

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 [label style=”3″]email_temp.html[/label] and copy the files to your [label style=”3″]wp-includes[/label].  Then you have to open [label style=”3″]wp-comments-post.php[/label] in the root of your WordPress installation. and search for the following function name.

[code style=”1″]

wp_new_comment( $commentdata );

[/code]

Then you have to paste the following codes just below that.

[code style=”1″]

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: [email protected]’ . “\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);
}

[/code]

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.

Reply email to the comment authors email in wordpress
Reply email to the comment authors email in wordpress

Enjoy WordPress reply email to the comment authors email. 🙂 🙂 🙂

 

 

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *