// forms and surveys
Via APIGravity Forms email verification with pingutil
Gravity Forms validates that the email field is formatted correctly, then saves the entry and fires every feed, so a bounced address ends up in your CRM and mailing list. The gform_field_validation filter runs on the server before the entry is saved, which means pingutil can reject an undeliverable or mistyped address and show the visitor a message while they are still on the page. This is one of the few form tools where real-time blocking is possible.
Where it connects: gform_field_validation PHP filter (runs before the entry is saved)
What goes wrong without it
- Our Gravity Forms feeds push every entry to HubSpot and Mailchimp, including the ones with typos.
- Visitors mistype their own email and then complain they never got the download link.
- Spam bots get past the honeypot with random addresses at real-looking domains.
What you can do with Gravity Forms and pingutil
Ask the visitor to fix a typo
When pingutil returns invalid with a did_you_mean suggestion, fail validation with "Did you mean jane@gmail.com?" so the visitor corrects it before submitting.
Keep feeds clean
Because validation runs before the entry is created, entries with undeliverable addresses never trigger your CRM, email marketing or webhook feeds.
Block throwaways on gated content
Reject disposable_domain results on ebook or webinar forms where a temp-mail address just harvests the download.
Set it up
- 1
Create a pingutil key and define it in wp-config.php: define( 'PINGUTIL_KEY', 'pk_live_...' );
- 2
Add the filter below to a small site plugin or your theme's functions.php.
- 3
To limit it to one form or field, change the hook name to gform_field_validation_<form id>_<field id>.
- 4
Submit the form with a typo such as name@gmial.com and confirm the message appears under the email field.
- 5
Submit with a real address and confirm the entry saves and feeds run as before.
<?php
add_filter( 'gform_field_validation', 'pingutil_gf_validate_email', 10, 5 );
function pingutil_gf_validate_email( $result, $value, $form, $field, $context ) {
if ( ! rgar( $result, 'is_valid' ) || $field->get_input_type() !== 'email' ) {
return $result;
}
// With email confirmation enabled, $value is an array and the address is index 0.
$email = trim( is_array( $value ) ? rgar( $value, 0 ) : $value );
if ( $email === '' ) {
return $result;
}
$response = wp_remote_post( 'https://pingutil.com/v1/verify', array(
'timeout' => 6, // the visitor is waiting; slow servers fail open
'headers' => array(
'Authorization' => 'Bearer ' . PINGUTIL_KEY,
'Content-Type' => 'application/json',
),
'body' => wp_json_encode( array( 'email' => $email ) ),
) );
// Timeout, network error, 429 quota_exceeded: let the entry through.
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
return $result;
}
$check = json_decode( wp_remote_retrieve_body( $response ), true );
if ( rgar( $check, 'status' ) === 'invalid' ) {
$result['is_valid'] = false;
$result['message'] = ! empty( $check['did_you_mean'] )
? sprintf( 'Did you mean %s?', esc_html( $check['did_you_mean'] ) )
: 'This email address cannot receive mail. Please check it or use another one.';
}
return $result;
}What to do with each result
| pingutil result | Action in Gravity Forms |
|---|---|
| status: "invalid" with did_you_mean | Fail validation with the suggested address in the message. |
| status: "invalid" (mailbox_not_found, no_mx, disposable_domain) | Fail validation and ask for another address. |
| status: "risky" | Let the entry through. Optionally store the status in a hidden field for feed conditions. |
| status: "unknown" or request failed | Let the entry through; never block a visitor because a mail server was slow. |
Limits to plan for
- The visitor waits for the check. Most answers are quick, but a slow mail server can take far longer than 6 seconds, so the snippet gives up and accepts the entry.
- Validation runs on each submit attempt, including multi-page form page changes and failed attempts, and every check counts toward the 300 verified addresses a day (3,000 a month). Target a specific form and field to keep the count down. Those are Free plan limits; Enterprise has custom limits.
- Catch-all domains come back risky, never valid, so the filter does not block them. That is deliberate: many real company domains accept all mail.
Gravity Forms documentation
Gravity Forms is a trademark of its owner. This integration uses Gravity Forms's documented extension points; it is not an official Gravity Forms app.
Common questions
- Does this work with the Gravity Forms email confirmation option?
- Yes. With confirmation enabled, the filter receives an array and the snippet reads the first value, as the Gravity Forms docs show.
- Will a failed check stop my feeds from running?
- Only when pingutil says invalid and the filter fails validation. In that case no entry is saved, so no feeds run. Every other outcome saves the entry normally.
Stop bad addresses in Gravity Forms today
Sign in with your email, create an API key and paste it into the step above. Test on a few real addresses first: the live demo shows exactly what your Gravity Forms setup will receive.