Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter kh7654

    (@kh7654)

    Just confirming we’ve now installed and tested partnering an external API for email verification running alongside the Gravity Forms Email Blacklist plugin, and they work together nicely. So you can use the plugin to catch addresses from your local blacklist and then hand over to the external API to ensure the address is otherwise valid.

    We are using Reeoon.com. This is the code we added in functions.php (adapted from the generic example supplied in Gravity Forms documentation):

    /* GF: email validation - external api */
    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,
                    'key' => 'yourapikey',
                ),
                'https://emailverifier.reoon.com/api/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, 'status' ) !== 'valid' ) {
                $result['is_valid'] = false;
                $result['message']  = 'Email is not valid';
            }
        }
      
        return $result;
    }, 10, 4 );
    • This reply was modified 3 years, 5 months ago by kh7654.
    Thread Starter kh7654

    (@kh7654)

    Thanks for the speedy and helpful reply response, Matt. I’ll give it a go and feed back.

Viewing 2 replies - 1 through 2 (of 2 total)