Plugin Directory

Test out the new Plugin Directory and let us know what you think.

Email Users

Allows the site editors to send an e-mail to the blog users. Credits to Catalin Ionescu who gave me (Vincent Pratt) some ideas for the plugin and has


All the instructions for installation, the support forums, a FAQ, etc. can be found on the plugin home page or on the plugin overview page.


Email Users has language translation support for a number of languages. New languages and updates to existing languages are always welcome. Thank you to the people who have provided these translations.

  1. Spanish (es_ES) - PonÁ J. Llaneras (last updated: 4.6.3)
  2. Bulgarian (sr_RS) - Borisa Djuraskovic (last update 4.6.2)
  3. Italian (it_IT) - ? (last updated 4.5.1)
  4. German (de_DE) - Tobias Bechtold (last updated 4.4.1)
  5. Persian (fa_IR) - ? (last updated 4.3.6)
  6. French (fr_FR) - Emilie DCCLXI (last updated 4.3.6)
  7. Russian (ru_RU) - ? (last updated 4.3.8)
  8. Chinese (zh_CN) - ? (last updated 4.5.1)
  9. Dutch (nl_NL) - Bart van Strien (last updated 4.6.3)


This plugin is available under the GPL license, which means that it's free. If you use it for a commercial web site, if you appreciate my efforts or if you want to encourage me to develop and maintain it, please consider making a donation using Paypal, a secured payment solution. You just need to click the donate button on the the plugin overview page and follow the instructions.

Filters and Actions

Email Users supports a number of filters and actions. 1. Action: mailusers_before_wp_mail - called before wp_mail is called. 1. Action: mailusers_after_wp_mail - called after wp_mail is called. 1. Filter: mailusers_manipulate_headers - called before wp_mail is called.

This example shows how the mailusers_manipulate_headers filter can be used to change the headers to be compatible with wpMandrill. This code could/would be placed in your functions.php file.

 * wpMandrill needs the recipients in the TO header instead
 * of the BCC header which Email Users uses by default.  This
 * filter will move all of the recipients from the BCC header
 * into the TO header and clean up any formatting and then nuke
 * the BCC header.
function mailusers_mandrill_headers($to, $headers, $bcc)
    //  Copy the BCC headers to the TO header without the "Bcc:" prefix
    $to = preg_replace('/^Bcc:\s+/', '', $bcc) ;

    //  Empty out the BCC header
    $bcc = array() ;

    return array($to, $headers, $bcc) ;

add_filter('mailusers_manipulate_headers', 'mailusers_mandrill_headers', 10, 3) ;

Custom Filter Usage

Email Users provides the ability to send email to a very specific set of users using a custom meta filter. To create a special mail list, you will need to add something similar to the following to your theme's functions.php file or create a separate plugin file.

The mailusers_register_user_custom_meta_filter() and mailusers_register_group_custom_meta_filter() actions each take 3-4 parameters: 1. Label - text that will appear on the WordPress Email-Users menu (users) or in the Recipient List (groups). 1. Meta Key - the meta key to search for in the user meta table. 1. Meta Value - the value to match against in the user meta table. 1. Meta Compare - optional, defaults to '='. The type of comparison to be performed.

This example will filter the user list to only those users where the first name is Alex.

add_action( 'mailusers_user_custom_meta_filter', 'first_name_alex', 5 );

function first_name_alex()
    mailusers_register_user_custom_meta_filter('First Name: Alex', 'first_name', 'Alex');

Regular SQL comparisons (=, !=, etc.) can be performed. Wildcard matches (LIKE, NOT LIKE) are not yet supported due to how the WordPress get_users() API currently handles LIKE comparison. A patch has been submitted and hopefully it will be addressed in WordPress 3.6. Once addressed, you will be able to create filters like the one below to specifically match last names which begin with the letter M.

add_action( 'mailusers_user_custom_meta_filter', 'last_names_starting_with_m', 5 );

function last_names_starting_with_m()
    mailusers_register_user_custom_meta_filter('Last Name: M', 'last_name', 'M%', 'LIKE');

In addition to filtering on User Meta data to build a custom list of users, you can now define custom groups based on User Meta data.

add_action( 'mailusers_group_custom_meta_filter', 'send_to_fire_department', 5 );

function send_to_fire_department()
    mailusers_register_group_custom_meta_filter('Fire Department', 'department', 'fire');

add_action( 'mailusers_group_custom_meta_filter', 'send_to_police_department', 5 );

function send_to_police_department()
    mailusers_register_group_custom_meta_filter('Police Department', 'department', 'police');

In addition to defining specific Meta Key and Value pairs, Email Users also supports a filter to generate the Meta Group filters based on a Meta Key. The Meta Key filter supports two optional arguments - a Meta Value and a function callback to generate the label. Neither is required. When the label callback is used, it receives two arguments, both strings, the Meta Key and Meta Value. It must return a string.

//  Define action to send to blog followers
add_action( 'mailusers_group_custom_meta_key_filter', 'send_to_my_blog_followers', 5 );

function send_to_my_blog_followers()

function send_to_departments_label($mk, $mv)
    return(ucwords($mk) . ' = ' . ucwords($mv)) ;

//  Define action to send to departments using custom callback to generate the label
add_action( 'mailusers_group_custom_meta_key_filter', 'send_to_departments', 5 );

function send_to_departments()
    mailusers_register_group_custom_meta_key_filter('department', null, 'send_to_departments_label');

function send_to_departments_label($mk, $mv)
    return(ucwords($mk) . ' = ' . ucwords($mv)) ;

New in v4.5.0 is an action, mailusers_update_custom_meta_filters, which can be used to dynamically update Meta Filters before they're used for recipient selection or email address retrieval. The example below leverages the Meta Key Department and its various values to define and update a new Meta Key called publicworks. Anytime a Group Email is sent or Post/Page notification is initiated, this action will fire and rebuild the publicworks meta key based on the values of the department meta key. This sort of action could be used to create more complex meta value relationships or to integrate other plugins.

add_action( 'mailusers_group_custom_meta_filter', 'send_to_public_works', 5 );

function send_to_public_works()
    mailusers_register_group_custom_meta_filter('Public Works', 'publicworks', true);

add_action( 'mailusers_update_custom_meta_filters', 'update_publicworks_meta_filter', 5 );

function update_publicworks_meta_filter()
    $pw_mk = 'publicworks' ;
    $dept_mk = 'department' ;

    //  Define the valid matches - the array keys match user
    //  meta keys and the array values match the user meta values.
    //  The array could contain a mixed set of meta keys and values
    //  in order to group users based on an arbitrary collection of
    //  user meta data.

    $publicworks = array(
        array($dept_mk => 'fire'),
        array($dept_mk => 'police'),
        array($dept_mk => 'water and sewer'),
        array($dept_mk => 'parks and recreation'),
    ) ;

    //  Remove all instances of the Public Works meta key
    //  to account for employees no longer with Public Works
    $uq = new WP_User_Query(array('meta_key' => $pw_mk)) ;

    foreach ($uq->get_results() as $u)
        delete_user_meta($u->ID, $pw_mk) ;

    //  Loop through the departs and select Users accordingly
    foreach  ($publicworks as $pw)
        $uq = new WP_User_Query(array('meta_key' => $dept_mk, 'meta_value' => $pw[$dept_mk])) ;

        //  Loop through the users in the department and tag them as Public Works employees
        foreach ($uq->get_results() as $u)
            update_user_meta($u->ID, $pw_mk, true) ;

Requires: 3.6.1 or higher
Compatible up to: 4.5.5
Last Updated: 6 months ago
Active Installs: 10,000+


4.5 out of 5 stars


2 of 9 support threads in the last two months have been marked resolved.

Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.

0,2,0 100,1,1
38,8,3 100,1,1
75,4,3 0,1,0
100,1,1 0,1,0
100,2,2 100,1,1
100,1,1 100,3,3
67,3,2 100,1,1
100,2,2 100,2,2 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,2,2