2011-03-25 2 views
0

등록 된 사용자가 게시물을 초안 할 수있는 프런트 엔드 게시 양식이 있습니다. 콘텐츠 초안을 작성한 사용자의 이메일이 포함 된 메타 필드가 있습니다. 이제 내가 백엔드에서 내용을 게시 할 때 게시물이 게시되었음을 알리는 전자 메일을 사용자에게 보냅니다.게시물이 WordPress에 게시 될 때 사용자에게 전자 메일 보내기

연구 방향에 어떤 종류의 도움이 될 것입니다.

감사합니다.

답변

0

PHP's mail function은 좋은 출발점이어야합니다. php.ini가 메일을 보내도록 올바르게 설정되었는지 확인하십시오.

+0

TNX위한 플러그인입니다! 또한 나는 내가 워드 프레스 대시 보드에서 포스트 게시 버튼을 클릭 할 때 어떻게 기능을 추가 할 수 있는지 알아야합니다. – Sisir

2
add_action('publish_post', 'send_email'); 
function send_notification($post_id) {  
     $post  = get_post($post_id); 
     $post_url = get_permalink($post_id); 
     $post_title = get_the_title($post_id); 
     $author = get_userdata($post->post_author); 
     $subject = 'Post publish notification'; 
     $message = "Hello,"; 
     $message .= "<a href='". $post_url. "'>'".$post_title."'</a>\n\n"; 
     wp_mail($author->user_email, $subject, $message); 
} 
관련 문제