WordPress കമന്റ് മറുപടി ഇമെയിൽ അയച്ചില്ലേ?സന്ദേശം, അഭിപ്രായം, ഇമെയിൽ അറിയിപ്പ്, സൗജന്യ പ്ലഗ്-ഇൻ കോഡ്

എന്റെ വേർഡ്പ്രസ്സ് കമന്റ് മറുപടി ഇമെയിൽ അയച്ചില്ലെങ്കിൽ ഞാൻ എന്തുചെയ്യണം?

സന്ദേശം കമന്റ് ഇമെയിൽ അറിയിപ്പ് സൗജന്യ പ്ലഗിൻ കോഡ്

മിക്ക ക്രോസ്-ബോർഡർ ഇ-കൊമേഴ്‌സ് പ്രാക്ടീഷണർമാരും വെബ്‌സൈറ്റുകൾ നിർമ്മിക്കുന്നതിനും അവരുടെ ബിസിനസുകൾ ഓൺലൈനിൽ പ്രൊമോട്ട് ചെയ്യുന്നതിനും വേർഡ്പ്രസ്സ് ഉപയോഗിക്കുന്നു , ഇത് അഭിപ്രായങ്ങൾക്കും സന്ദേശങ്ങൾക്കും മറുപടി അറിയിപ്പുകൾ ലഭിക്കാത്ത സാഹചര്യങ്ങളിലേക്ക് നയിച്ചേക്കാം.

അങ്ങനെയെങ്കിൽ, WordPress കമന്റ് മറുപടി ഇമെയിൽ അറിയിപ്പിന്റെ പ്രശ്നം പരിഹരിക്കാൻ നിങ്ങൾക്ക് പ്ലഗിൻ രഹിത കോഡ് ഉപയോഗിക്കാം.

നിങ്ങളുടെ WP തീമിന്റെ functions.php ഫയലിലേക്ക് ഇനിപ്പറയുന്ന കോഡ് ചേർക്കുക:

/**
* 评论回复邮件通知 By 陈沩亮
* 文章地址:https://www.chenweiliang.com/cwl-636.html
**/
 function cwl_comment_mail_notify($comment_id) {
     $comment = get_comment($comment_id);//根据id获取这条评论相关数据
     $content=$comment->comment_content;
     //对评论内容进行匹配
     $match_count=preg_match_all('/<a href="#comment-([0-9]+)?" rel="nofollow">/si',$content,$matchs);
     if($match_count>0){//如果匹配到了
         foreach($matchs[1] as $parent_id){//对每个子匹配都进行邮件发送操作
             SimPaled_send_email($parent_id,$comment);
         }
     }elseif($comment->comment_parent!='0'){//以防万一,有人故意删了@回复,还可以通过查找父级评论id来确定邮件发送对象
         $parent_id=$comment->comment_parent;
         SimPaled_send_email($parent_id,$comment);
     }else return;
 }
 add_action('comment_post', 'cwl_comment_mail_notify');
 function SimPaled_send_email($parent_id,$comment){//发送邮件的函数 by www.chenweliang.com
     $admin_email = get_bloginfo ('admin_email');//管理员邮箱
     $parent_comment=get_comment($parent_id);//获取被回复人(或叫父级评论)相关信息
     $author_email=$comment->comment_author_email;//评论人邮箱
     $to = trim($parent_comment->comment_author_email);//被回复人邮箱
     $spam_confirmed = $comment->comment_approved;
     if ($spam_confirmed != 'spam' && $to != $admin_email && $to != $author_email) {
         $wp_email = 'no-reply@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); // e-mail 发出点, no-reply 可改为可用的 e-mail.
         $subject = '你在 [' . get_option("blogname") . '] 的留言有了回应';
         $message = '<div style="background-color:#eef2fa;border:1px solid #d8e3e8;color:#111;padding:0 15px;-moz-border-radius:5px;-webkit-border-radius:5px;-khtml-border-radius:5px;">
             <p>' . trim(get_comment($parent_id)->comment_author) . ', 你好!</p>
             <p>你曾在《' . get_the_title($comment->comment_post_ID) . '》的留言:<br />'
             . trim(get_comment($parent_id)->comment_content) . '</p>
             <p>' . trim($comment->comment_author) . ' 给你的回复:<br />'
             . trim($comment->comment_content) . '<br /></p>
             <p>你可以点击 <a href="' . htmlspecialchars(get_comment_link($parent_id,array("type" => "all"))) . '">查看回复的完整內容</a></p>
             <p>欢迎再度光临 <a href="' . get_option('home') . '">' . get_option('blogname') . '</a></p>
             <p>(此邮件由系统自动发出, 请勿回复)</p></div>';
         $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 );
     }
 }

ചെൻ വെയ്‌ലിയാങ്ങിന്റെ ബ്ലോഗിൽ ( https://www.chenweiliang.com/ ) പങ്കിട്ട "വേർഡ്പ്രസ്സ് കമന്റ് മറുപടികൾ ഇമെയിലുകൾ അയച്ചില്ലെങ്കിൽ എന്തുചെയ്യണം? കമന്റ് ഇമെയിൽ അറിയിപ്പുകൾക്കുള്ള പ്ലഗിൻ-ഫ്രീ കോഡ്" എന്ന ലേഖനം നിങ്ങൾക്ക് സഹായകരമാകുമെന്ന് പ്രതീക്ഷിക്കുന്നു.

ഈ ലേഖനത്തിന്റെ ലിങ്ക് പങ്കിടാൻ മടിക്കേണ്ടതില്ല: https://www.chenweiliang.com/cwl-636.html

കൂടുതൽ മറഞ്ഞിരിക്കുന്ന തന്ത്രങ്ങൾ അൺലോക്ക് ചെയ്യാൻ🔑, ഞങ്ങളുടെ ടെലിഗ്രാം ചാനലിൽ ചേരാൻ സ്വാഗതം!

ഇഷ്ടമായാൽ ഷെയർ ചെയ്യുക, ലൈക്ക് ചെയ്യുക! നിങ്ങളുടെ ഷെയറുകളും ലൈക്കുകളും ഞങ്ങളുടെ തുടർച്ചയായ പ്രചോദനമാണ്!

 

发表 评论

您的邮箱地址不会被公开。必填项已用*标注

ടോപ്പ് സ്ക്രോൾ