Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BCC an additional email on PMPro admin emails.
/*
Add bcc for PMPro admin emails
*/
function my_pmpro_email_headers_admin_emails($headers, $email)
{
//bcc emails already going to admin_email
if(strpos($email->template, "_admin") !== false)
{
//add bcc
$headers[] = "Bcc:" . "otheremail@domain.com";
}
return $headers;
}
add_filter("pmpro_email_headers", "my_pmpro_email_headers_admin_emails", 10, 2);
@rwilki

This comment has been minimized.

Copy link

commented Aug 10, 2018

If we need more than one bcc address, is the code:

$headers[] = "Bcc:" . "otheremail@domain.com, otheremail2@domain.com";
or
$headers[] = "Bcc:" . "otheremail@domain.com", "otheremail2@domain.com";

@pbrocks

This comment has been minimized.

Copy link

commented Aug 10, 2018

Hi there, the first one should work!

@837y4rt8

This comment has been minimized.

Copy link

commented Mar 22, 2019

Is there any way to get this to work for approval emails? (from the approvals add on)

It doesn't work for those emails, I think because those email templates use a different naming convention, but I am not sure.

@LMNTL

This comment has been minimized.

Copy link

commented Sep 16, 2019

@837y4rt8 There's a forked version of this gist that also handles approval emails, you can find it here:
https://gist.github.com/LMNTL/3162ad9035f0bc77a03ea83ee8afa2ca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.