hi @guicmazeredo,
Thanks for that. As stated in my first post above, reCaptcha is not a subsitute for bad actors that spam accounts by using a different (bogus) email address every time. Please try it yourself. reCaptcha will not stop them.
So, implementing a filter (similar to the one below), will help tremendously. The filter can be offered via your documentation (filters) and/or via a toggle in your plugin’s settings (WP Dashboard > MailPoet > Settings > Advanced). (Hint: Add the toggle to the Premium version of your plugin).
The third-party API can be obtained (at no-cost, no credit-card required) from quickemailverification.com. Instructions for obtaining the API are provided here.
Should not be difficult to implement. All you need is to create the hook (‘mailpoet_email_validation‘) and modify the function given below.
I provided the framework for this request, you can now make it happen ??
Cheers!
——————–
add_filter( 'mailpoet_email_validation', function ( $result, $value, $form, $field ) {
if ( $field->get_input_type() === 'email' && $result['is_valid'] ) {
$request_url = add_query_arg(
array(
'email' => $value,
'apikey' => 'your_api_key_here',
),
'https://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 );