Email Users v4.7.1-beta-2 available

This evening I released beta-2 of Email Users v4.7.1.  This build addresses a couple of issues and introduces a new filter which allows manipulation of portions of the generated email headers.

The Dashboard Widget can now be disabled.  It is on by default but can be turned off with a setting (Dashboard > Settings > Email Users).

There have been several requests to support wpMandrill.  It wasn’t until recently that I learned that in addition to overloading wp_mail(), Mandrill requires the recipient addresses to be in the TO header where as Email Users uses the BCC header to send email.

I didn’t want to make it simple to use the TO header instead of the BCC header as I view it as risky.  Exposing the recipients of a mass mailing is a no-no.  However, Mandrill is widely used and with several requests, I needed a safe yet viable solution.

The new mailusers_manipulate_headers allows the user to modify the headers so they’ll work with Mandrill while not making it too easy to do so.  Here is an example of how the headers could/would be modified to have the recipients in the TO header instead of the BCC header.

/**
 * 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) ;

This code would be placed in the functions.php file.  More details can found in the ReadMe.txt file.  The example above is now included with the plugin, you can find it in the examples directory.

Email Users Beta (4998 downloads )

Leave a Reply