[英]Wordpress Php auto email to comment author
我希望能夠自動將評論發送給對我網站上的帖子發表評論的人。 他們的電子郵件是必需的,所以我覺得我應該能夠抓住這個並使用php將電子郵件發送回該電子郵件地址...
我知道php電子郵件的基礎知識如下...所以我只需要幫助來抓取作者的電子郵件並將其放入mailTo變量中
<?php
$subject = 'My subject';
$message = "The Message I'd like to send back to the commenter";
$mailTo = get_comment_author_email_link
mail($mailTo, $subject, $message);
?>
謝謝!
我認為您需要的是使用您自己定義的函數來鏈接到評論發布操作:
<?php
function sendMail($id){
$subject = 'My subject';
$message = "The Message I'd like to send back to the commenter";
$comment=get_comment($id);
$mailTo = $comment->comment_author_email ;
mail($mailTo, $subject, $message);
}
add_action('comment_post', 'sendMail');
?>
您可以使用它,但不要忘記webarto
的評論:
http://wordpress.org/extend/plugins/wp-comment-auto-responder/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.