instead of having the bcc a static adresse i want the to to be the static adresse
Here is what i got so far:
From: WP Email Adress To: Multiple Player from one Team(Role) BCC: Trainers Email Adress
What i want:
From: WP Email Adress To: Trainers Email Adress BCC: Multiple Player from one Team(Role)
<?php // CUSTOM EMAIL HANDLER OBERBAYERN
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: trainersemail@adresse.com' ;
wp_mail( $emails,$subject, $message,$headers );}}
add_action( 'transition_post_status', 'oberbayern_mailer', 10, 3 );?>
I freaking out cant get it work : ) Hoping for help
source https://stackoverflow.com/questions/73569237/wp-mail-bcc-to-multiple-role-specific-user
No comments:
Post a Comment