0

Get API Key from here: https://quickemailverification.com/

after that use bellow code with API key

add_filter( 'gform_field_validation_16', 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',
            ),
            '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 invalid';
        }
    }
      return $result;
}, 10, 4 );

Jagdish Sarma Asked question July 7, 2021
Add a Comment