How to send E-mail to all registered users?

1643

How are you all? I hope all of you are fine. Once again, I presented with a small post of WordPress. And that is “how to send E-mail to all registered users of your site in the same time“. Before giving the new post I gave my previous post link, I hope those who have missed it will work for them.

Send Email to All Registered Users in WordPress

how-to-send-email-to-all-registered-users-in-wordpress

E-mail marketing is one of the ways of bringing visitors in online. Through E-mail you can bring visitor direct in your site. So through E-mail if you want to inform all registered users, then this post is for you.

If you want to inform to all registered users through E-mail about bringing new post of site, then using following tutorial you can do that easily.

Paste following code in function file functions.php  of your theme.

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 tutorial have been published on http://www.itshikkha.com');
    return $post_ID;
}
add_action('publish_post', 'email_members');

Don’t forget to write the name of your site which is situated in below.

Thank you for reading this article. I hope this post will work for you. If there is any mistake, then forgive me. If you face any problem, then don’t forget to comment. If you think the article is beneficial then obviously share it.

Also Read: