Hi @jaegerms
Thx for the reply. I managed to solve the problem without the plugin and adding a function to the plugin. I will just leave it here in case someone else need it in the future.
function check_mail_send_contactform($cf7) {
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
}
$mail = $cf7->prop( ‘mail’ );
if($posted_data[‘newsletter’][0]) {
$mail2 = $cf7->prop( ‘mail_2’ );
$mail2[‘recipient’] = $posted_data[‘your-email’];
$cf7->set_properties( array( ‘mail_2’ => $mail2 ) );
}
return $cf7;
}
add_action(‘wpcf7_before_send_mail’,’check_mail_send_contactform’);
Cheers