Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Last active January 26, 2022 18:07
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save strangerstudios/e746bae5e5f8f75e185d to your computer and use it in GitHub Desktop.
Save strangerstudios/e746bae5e5f8f75e185d to your computer and use it in GitHub Desktop.
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
Copy link

rwilki 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
Copy link

pbrocks commented Aug 10, 2018

Hi there, the first one should work!

@837y4rt8
Copy link

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
Copy link

LMNTL 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

@laurenhagan0306
Copy link

This recipe is included in the blog post on "BCC Additional Email Addresses on Member or Admin Notifications" at Paid Memberships Pro here: https://www.paidmembershipspro.com/bcc-additional-email-addresses-on-member-or-admin-notifications/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment