Hi,
I'm trying to add a Bcc: header to a contact form that gets it address through a shortcode. I'd like to to set when sending the mail without ever publicicly exposing the address. I feel I'm close, but it's just not adding the Bcc. The code:
add_action( 'wpcf7_before_send_mail', 'add_affiliate_bcc' );
function add_affiliate_bcc( $wpcf7 ) {
$affiliate_recipient = do_shortcode('[affiliate_recipient]');
if ( $affiliate_recipient AND stristr( $wpcf7->title, 'order') ) :
$wpcf7->setup_mail_template( array('additional_headers' => 'Bcc: ' . affiliate_recipient, 'subject' => 'modified header successfully!' ) );
endif;
}
But alas, no header ever get's modified, and the mail goes out just the same way as without the action. Anyone more knowledgeable in here who could help me out?