Quick answer: To block email domains in Fluent Forms, hook into fluentform/validate_input_item_input_email, read the domain after the @ sign and return an error message when it is on your blocked list. The two snippets below work on all forms or only on the forms you choose.
Table of Contents

Why block email domains in Fluent Forms?
- Stop spam bots that use disposable addresses such as mailinator.com.
- Make B2B or quote forms accept only company emails (no Gmail or Yahoo).
- Block a specific person or address that keeps sending junk.
Fluent Forms validates every email field through a filter (see the Fluent Forms developer docs), so you can reject an address before the entry is saved and show your own error message.
Snippet 1: apply to all forms
Add this to your child theme functions.php or a code snippets plugin, then change the domains and message.
/**
* Fluent Forms: block email domains and addresses (all forms).
*/
add_filter( 'fluentform/validate_input_item_input_email', function ( $error, $field, $formData, $fields, $form ) {
$blocked_domains = array( 'mailinator.com', 'tempmail.com', 'test.com' ); // change these
$blocked_emails = array( 'spam@example.com' ); // exact addresses (optional)
$message = 'Please use your business email address.';
$name = $field['name'];
$email = isset( $formData[ $name ] ) ? strtolower( trim( $formData[ $name ] ) ) : '';
if ( '' === $email || false === strpos( $email, '@' ) ) {
return $error;
}
$domain = substr( strrchr( $email, '@' ), 1 );
if ( in_array( $domain, $blocked_domains, true ) || in_array( $email, $blocked_emails, true ) ) {
return array( $message );
}
return $error;
}, 10, 5 );
Snippet 2: block domains on selected forms only
Use this if only your quote or B2B form should reject free email providers. Find the form ID in Fluent Forms > All Forms.
/**
* Fluent Forms: block email domains on specific forms only.
*/
add_filter( 'fluentform/validate_input_item_input_email', function ( $error, $field, $formData, $fields, $form ) {
$form_ids = array( 12, 15 ); // your form IDs
$blocked_domains = array( 'gmail.com', 'yahoo.com', 'hotmail.com' );
$message = 'Please use your company email address.';
if ( ! in_array( (int) $form->id, $form_ids, true ) ) {
return $error;
}
$name = $field['name'];
$email = isset( $formData[ $name ] ) ? strtolower( trim( $formData[ $name ] ) ) : '';
$domain = $email ? substr( strrchr( $email, '@' ), 1 ) : '';
if ( $domain && in_array( $domain, $blocked_domains, true ) ) {
return array( $message );
}
return $error;
}, 10, 5 );
How the code works
- The filter runs for every email field when the form is submitted.
- The email is trimmed and lower-cased, so
Test@Mailinator.COMis caught too. - The part after
@is compared with your blocked list. - Returning an array with a message stops the submission and shows that message under the field.
Troubleshooting
- Nothing happens on an older Fluent Forms version: before version 5, the hook was named
fluentform_validate_input_item_input_email(underscore instead of slash). Use that name instead. - Subdomains still get through: add them to the list, for example
mail.example.com. - Error shows on every email: make sure the domains in the array are lower-case and have no spaces.
Frequently asked questions
Can Fluent Forms block email domains without code?
Fluent Forms Pro has some validation options, but blocking a custom list of domains is easiest with the small PHP snippet above.
How do I block Gmail in Fluent Forms?
Add gmail.com to the blocked domains array in either snippet. Snippet 2 lets you do it only on the forms where you need company emails.
Will this stop all spam?
It stops sign-ups from the domains you list. Combine it with Fluent Forms’ built-in reCAPTCHA or Turnstile for bots.
Need help with forms, spam or WordPress customisation? Get a free quote.
Related guides
- Disable WooCommerce Payment Gateway for Specific Country WordPress
- Create a WordPress Admin User via functions.php or WP-CLI (Safe Method)
- WordPress Development Cost in 2026: Prices and Hiring Guide
Need help with your own site? Get a free quote or see my recent builds.



