Email verification in Gravity Forms


Description: 

Get 100 free emails a day.

Put php code in functions.php. Add api key which get at (see url).




Kind:

PHP


PHP:

add_filter( 'gform_field_validation', function ( $result, $value, $form, $field ) {
if ( $field->get_input_type() === 'email' && $result['is_valid'] ) {
$request_url = add_query_arg(
array(
'email' => $value,
'apikey' => '...api key here...',
),
'http://api.quickemailverification.com/v1/verify'
);

$response = wp_remote_get( $request_url );
$response_json = wp_remote_retrieve_body( $response );
$response_array = json_decode( $response_json, 1 );

if ( rgar( $response_array, 'result' ) !== 'valid' ) {
$result['is_valid'] = false;
$result['message'] = 'Email is ongeldig';
}
}

return $result;
}, 10, 4 );


URL: