Sorry, but I don’t understand what you mean. The plugin will fetch all users that are supposed to receive the emails and then grab their email addresses and add to a unique list (so people don’t get duplicated emails).
Are you saying that with https://ww.wp.xz.cn/plugins/multiple-admin-email-addresses/ active bbpnns no longer works?
When I have an extra admin email address under Settings – General – Email address separated by a comma it stops working.
Not if only that plugin is installed and active but only when I add an email address as admin email. See screenshot https://prnt.sc/havc4k
I haven’t tested to be sure, but that’s probably because the plugin uses that field to set the From email header
$headers = array( sprintf( "From: %s <%s>", get_option( 'blogname' ), get_bloginfo( 'admin_email' ) ) );
WordPress does not expect Settings – General – Email address to have multiple addresses separated by commas.
However, if you really want to use those multiple emails, you’ll have to hook into the headers filter and fix the From header. the filter is bbpnns_extra_headers and it’s called like so:
$headers = apply_filters( 'bbpnns_extra_headers', $headers, $recipients, $subject, $body );
I hope this helps.
Where and how could I use this? Can this be in my functions.php? If so, what is the exact code?
In functions.php:
/**
* Make bbpnns select the first email address when admin email field contains multiple
* addresses separated by commas.
*/
function my_adjust_bbpnns_from_header( $headers, $recipients=array(), $subject='', $body='' )
{
foreach ( $headers as &$h )
{
if ( 'From:' === substr( $h, 0, strlen('From:') ) && preg_match( '/<.*,.*>/', $h ) )
{
$h = preg_replace( '/<([^>,]+)?,[^>]+>/', '<$1>', $h );
}
}
return $headers;
}
add_filter( 'bbpnns_extra_headers', 'my_adjust_bbpnns_from_header', 10, 4 );
Cheers,
Vinny
I saw it, thank you very much!