Last active
January 26, 2022 18:07
-
-
Save strangerstudios/e746bae5e5f8f75e185d to your computer and use it in GitHub Desktop.
BCC an additional email on PMPro admin emails.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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:" . "[email protected]"; | |
} | |
return $headers; | |
} | |
add_filter("pmpro_email_headers", "my_pmpro_email_headers_admin_emails", 10, 2); |
Hi there, the first one should work!
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.
@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
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
If we need more than one bcc address, is the code:
$headers[] = "Bcc:" . "[email protected], [email protected]";
or
$headers[] = "Bcc:" . "[email protected]", "[email protected]";