Send BCC instead of TO
-
<?php // CUSTOM EMAIL HANDLER SOCCER TEAM function oberbayern_mailer( $new_status, $old_status, $post ){global $post; if ( 'publish' !== $new_status or 'publish' === $old_status ) return; if( has_term( 'oberbayern', 'event_category' ) ) { $spielern = get_users( array ( 'role' => 'oberbayern' ) ); $emails = array (); foreach ( $spielern as $spieler ) $emails[] = $spieler->user_email; $post_title = get_the_title( $post_id ); $post_url = get_permalink( $post_id ); $subject = 'Das Spiel wurde verschoben'; $message .= "Das Spiel\n -> ". $post_title. " <-\nwurde verschoben. \n\nBitte prüfen Sie den folgenden Link: " . $post_url. "\n\n\n\n\n\nMit freundlichen Grüßen\n\n\n\nWeb Org Team\nFußballverein 1 Bayern"; $headers = 'bcc: coachemail@adresse.com' ; wp_mail( $emails,$subject, $message,$headers );}} add_action( 'transition_post_status', 'oberbayern_mailer', 10, 3 );?>Now it is sending an email to all Players of the team Oberbayern and a static Bcc to the coach when the status of a post is changed.
I want to swap the function to:
If the status of a Post is changed, the coach gets the Email and all the Players get the Bcc.
Means i need to swapp “TO” to “BCC”. Any help – this one seems hard.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Send BCC instead of TO’ is closed to new replies.