Wouldn’t it be great if you could automatically send an email to your registered subscribers and notify them of a new post?

Simply add this code to your functions.php file, and all registered users will receive an email when a new post is published.

[php]
function email_members($post_ID) {
global $wpdb;
$usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;");
$users = implode(",", $usersarray);
mail($users, "New WordPress recipe online!", ‘A new recipe have been published on http://www.wprecipes.com’);
return $post_ID;
}

add_action(‘publish_post’, ‘email_members’);

[/php]

Related Articles

Tagged with:
 

Comments are closed.