Skip to content

Instantly share code, notes, and snippets.

@aimahdi
Last active January 11, 2023 16:46
Show Gist options
  • Save aimahdi/83afa2ea687cf1e2d9babeb5b7138799 to your computer and use it in GitHub Desktop.
Save aimahdi/83afa2ea687cf1e2d9babeb5b7138799 to your computer and use it in GitHub Desktop.
add_action('fluentform_before_insert_submission', 'validate_email_reoon', 10, 3);
function validate_email_reoon($insertData, $data, $form)
{
if($form->id != 633) { //change the form id with your form id
return;
}
$apiKey = 'lYlSwj3Uxt5iGecFTHYdqKC4xBQYaClf'; //put your api key here
$apiUrl = 'https://emailverifier.reoon.com/api/v1/verify?email='.$data['email'].'&key='.$apiKey.'&mode=quick';
$response = wp_remote_get($apiUrl);
$body = json_decode($response['body']);
if($body->status != 'valid'){
return wp_send_json_error("This is not a valid email");
}
// DO your stuffs here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment