if(@mail($admin_email, $form_subject, $message, $headers, $ip )) {
echo json_encode(['status' => 'mail_sent','redirect' => '/url/']);
}
case 'mail_sent':
$message.addClass('wpcf7-mail-sent-ok');
$form.addClass('sent');
wpcf7.triggerEvent(data.into, 'mailsent', detail);
if (typeof data.redirect !='undefined') document.location.href=data.redirect;
break;