add_action( 'wpcf7_before_send_mail', 'change_recepient_before_send_mail', 10, 1);
function change_recepient_before_send_mail($form) {
$submission = WPCF7_Submission::get_instance();
if ($submission) {
$posted_data = $submission->get_posted_data();
if (empty($posted_data) || empty($posted_data['input-radio-name'])) {
return $form;
}
$selected_email = $posted_data['input-radio-name'];
$mail = $form->prop('mail') ;
$mail['recipient'] = $recipient;
$form->set_properties( array("mail" => $mail)) ;
return $form;
}
}