Dynamic CC Additional Header
-
Hi,
I am attempting to add an additional ‘cc’ header to the email being sent via CF7 coupled with ACF custom field. However, the email sends successfully without the ‘cc’ added. Perhaps been staring at it for too long, but I can’t figure it out as yet. Code below in ‘functions.php’.function add_jobmanager_recipient( $cf7 ) { global $post; $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $data = $submission->get_posted_data(); $cc_email = get_field( 'job_contact_email_address', $post->ID ); if ( empty( $data ) || empty( $cc_email ) ) { return; } $mail = $cf7->get_properties(); $mail[ 'mail' ][ 'additional_headers' ] .= "\r\nCc: $cc_email"; $cf7->set_properties( $mail ); } return $cf7; } add_action( 'wpcf7_before_send_mail', ' add_jobmanager_recipient', 20, 2 );
Thanks for any pointers.
Cheers,
Rob
—
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Dynamic CC Additional Header’ is closed to new replies.