Appointment+ BCC for confirmation email

When Appointment+ sends an e-mail to the customer to confirm the appointment, I want a bcc added to the email.
How can I do this?

  • Majid

    Hello Soufian Ennajat :slight_smile:
    I hope you are doing great today

    We forwarded this ticket to our Second Level Support team to get their valuable feedback if there is a hook that can be used to achieve this. One of our SLS members will reply back here as soon as more information is available.

    Please keep in mind that our SLS Team deals with more complicated issues, thus it may take a little longer for them to reply here. Thank you for your patience while we look into this further.

    Best Regards,
    Majid

  • Vaughan

    Hi Soufian Ennajat

    Can you try this:

    It should work as long as the Confirmation email subject contains the words appointment & confirmation.

    Add the following code to your theme functions.php or a mu-plugin.

    add_filter( 'wp_mail', 'my_wp_mail_filter' );
    function my_wp_mail_filter( $args ) {
        $bcc_email = 'example@abc.com';
    
        if(strpos(strtolower($args['subject']), 'appointment') && strpos(strtolower($args['subject']), 'confirmation')) {
            if (is_array($args['headers'])) {
                $args['headers'][] = 'Bcc: ' . $bcc_email;
            } else {
                $args['headers'] .= 'Bcc: ' . $bcc_email . "\r\n";
            }
        }
    
    	$new_wp_mail = array(
    		'to'          => $args['to'],
    		'subject'     => $args['subject'],
    		'message'     => $args['message'],
    		'headers'     => $args['headers'],
    		'attachments' => $args['attachments'],
    	);
    
    	return $new_wp_mail;
    }

    Change $bcc_email value for the email you want to Bcc.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.