🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!
Guides & Tutorials November 3, 2026

How to Restrict Email Domains per Field in Gravity Forms

GravityExtra
How to Restrict Email Domains per Field in Gravity Forms

Not every form should accept every email address. A staff request form is only useful when people sign in with their company address. A student registration form should only take school addresses. A public newsletter or a free trial form fills up with throw-away inboxes that never open a single message. The standard Gravity Forms Email field checks that an address looks like an email address, but it does not care which domain it comes from. This guide shows how to restrict email domains in Gravity Forms per field: accept only the domains you choose, refuse the ones you never want, match whole groups of domains with wildcards such as *.example.com or .edu, and show your own error message with the domain the visitor typed.

Why limit email domains on a form

A domain rule is a simple filter with a big effect on the quality of your entries. Common cases:

  • Staff and internal forms: IT requests, leave requests or expense claims should come from yourcompany.com addresses only, so you know who sent them.
  • Schools and training: a course sign-up or a student discount form that only accepts addresses ending in .edu or your own school domain.
  • Partner and reseller portals: a short list of partner domains that may request access, price lists or support.
  • Business-only (B2B) leads: a quote form that refuses free webmail addresses so your sales team gets real company contacts.
  • Public sign-ups: a newsletter, giveaway or free trial form that refuses the throw-away domains you keep seeing in your entries.

Two levels of control: site-wide and per field

The Gravity Forms Email Validator add-on works on two levels.

Site-wide settings live under Forms → Settings → Email Validator Add-on. Here you choose the validator (Basic, or the Kickbox or ZeroBounce validation services with your own API key), the rules of the Basic validator, and one Domain Validator Settings list that allows or blocks domains on every Email field of the site.

Field rules are new in version 1.1. Each Email field can now have its own domain rule that replaces the site-wide list for that field only. That is what most real sites need: one form accepts only company addresses, a second form refuses a few throw-away domains, and every other form keeps following the site-wide settings. You no longer have to choose one list that fits every form on the site.

Before you start

  • Gravity Forms with at least one form that has an Email field.
  • Email Validator 1.1 or later with an active licence key. The validation rules run only with a valid licence.
  • Nothing changes on your existing forms when you update: every Email field starts on “Use the add-on settings”, which is exactly the behaviour of version 1.0.

Step 1: Open the Email field and pick a rule

Open your form in the form editor and click the Email field. In the General tab you will find a new setting called Email domains for this field with four options:

  • Use the add-on settings (default): the field follows the site-wide Domain Validator list, as before.
  • Only accept these domains: an allow list. Any address from a domain that is not on the list is refused.
  • Refuse these domains: a block list. Addresses from the listed domains are refused, every other domain is accepted.
  • No domain rule on this field: the site-wide domain list is skipped for this field. Use it for a contact form that must accept any address even when the site-wide list is strict.

When you pick “Only accept these domains” or “Refuse these domains”, two more boxes appear: the domain list and an optional error message.

Step 2: Type the domains, one per line

Type one domain per line in the Domains box. Commas and spaces also work as separators, so you can paste a list from a spreadsheet or an email. Three kinds of entries are supported:

  • example.com or @example.com: exactly that domain. anna@example.com matches, anna@mail.example.com does not.
  • *.example.com: the domain and all of its subdomains, so example.com, mail.example.com and eu.mail.example.com all match. Use this for companies and universities that give departments their own subdomain.
  • .edu: every domain that ends with .edu, such as school.edu or cs.school.edu. The same works for .ac.uk, .gov or any other ending.

Upper and lower case are the same, so Example.COM and example.com are one entry. Lines with characters that cannot be part of a domain are ignored, and an empty list refuses nothing, so a half-finished field never blocks your whole form.

Gravity Forms Email field setting Email domains for this field set to Only accept these domains, with a domain list using a wildcard subdomain and .edu, and an optional error message box

In the example above the field accepts studio.example, every subdomain of school.example and every domain that ends with .edu. Everything else is refused with a message.

Step 3: Write a clear error message

The Error message box is optional. When you leave it empty, the visitor sees a short default text:

  • for an allow list: “Please use an email address from one of the accepted domains.”
  • for a block list: “Email addresses from {domain} are not accepted. Please use a different email address.”

Type your own text to match the tone of the form. Add {domain} anywhere in the message and it is replaced with the domain the visitor typed, for example: “Please use your own address: {domain} is a throw-away domain.” A good message tells the visitor what to do next, such as “Please use your company email address (name@yourcompany.com)”. The message and the typed domain are escaped before they are shown, so nothing a visitor types can change the page.

Step 4: Save the form and test it

Click Save Form, open the form preview and try an address from a domain that should be refused. The form shows the message above the field, and the usual Gravity Forms summary at the top lists every field that needs attention.

A Gravity Forms form with two Email fields: the work email field refuses a domain that is not on its allow list and the personal email field refuses a throw-away domain with a custom message

This form has two Email fields with two different rules. Work email only accepts company domains and uses the default allow-list message. Personal email refuses a list of throw-away domains and uses a custom message with {domain}. One form, two rules, no code.

A few things worth knowing while you test:

  • The check runs on the server when the form is submitted. It does not depend on JavaScript, so it cannot be skipped from the browser, and the domain rules add no extra script or markup to the form page.
  • It works with “Enable Email Confirmation”. When the field asks the visitor to type the address twice, the rule checks the address itself.
  • The first message wins. When an address is already refused for another reason, for example a wrong format or a failed check of the validation service, the visitor sees that first message and not a second one.
  • The value is saved as typed. The rule only decides whether the address is accepted; it does not change the entry.

Ready-made recipes

Staff-only request form. Rule: Only accept these domains. Domains: *.yourcompany.com. Message: “Please use your work email address (name@yourcompany.com).”

Student registration. Rule: Only accept these domains. Domains: .edu on one line and your partner schools on the next lines. Message: “This offer is for students. Please use your school email address.”

Partner portal. Rule: Only accept these domains. Domains: one partner domain per line. When a new partner joins, add one line and save the form.

Public newsletter or free trial. Rule: Refuse these domains. Domains: the throw-away domains you have seen in your entries. Message: “Please use your own address: {domain} is a throw-away domain.”

Contact form that must accept everyone. Rule: No domain rule on this field. Even when the site-wide list is strict, customers can always reach you.

Block disposable and free email providers site-wide

A hand-made block list is great for the domains you know. For the long tail of disposable inbox providers, the Basic validator has ready-made checks. Go to Forms → Settings → Email Validator Add-on, choose Basic as the validator, set Validator Rules to “Use custom rules” and tick the checks you need:

  • Block disposable emails: refuses temporary addresses that people create only to sign up without giving their real address.
  • Block free email accounts: refuses free webmail addresses. Useful on business-only forms, but too strict for most public forms.
  • Require configured MX Record: refuses domains that cannot receive email at all.
  • Sanitize Gmail email addresses that use the “plus trick”: handles addresses such as name+test@gmail.com.

These checks apply to Email fields that have Enable Email Validator ticked in their field settings. You can also turn on “Did you mean?” suggestions for misspelled addresses, and the entry can keep the validation result, so you can see why an address passed or failed.

The two levels work well together. For example, keep “Block disposable emails” on for the whole site and give your staff form an “Only accept these domains” rule. The site-wide check stops throw-away inboxes everywhere, and the field rule makes sure the staff form only gets company addresses.

A fix for forms with email confirmation

Version 1.1 also fixes a problem of earlier versions. On a form that used Enable Email Confirmation together with a site-wide domain list, the domain check could not read the address: on newer PHP versions the submission ended with an error page, and on older PHP versions an allow list refused every address. Version 1.1 reads the address correctly, so if you avoided the confirmation box because of this, you can turn it back on after the update.

Tips for good domain rules

  • Prefer an allow list when you know the audience. A list of three company domains is easy to keep up to date; a list of every bad domain on the internet is not.
  • Use wildcards for organisations with subdomains. *.university.example covers the main domain and every faculty domain in one line.
  • Say what is expected. Put a short hint in the field description, such as “Use your company email address”, so visitors get it right the first time.

Need to block words, phrases or IP addresses as well as domains? That is a different job, covered in our guide on blocking words, domains and IPs in Gravity Forms.

Frequently asked questions

Does a field rule replace the site-wide domain list? Yes, for that field only. A field set to “Only accept these domains”, “Refuse these domains” or “No domain rule on this field” ignores the site-wide Domain Validator list. Fields on “Use the add-on settings” keep following it.

Does example.com also match mail.example.com? No. A plain domain matches only itself. Use *.example.com to include all subdomains.

Can I accept every school address? Yes. Add .edu (or .ac.uk, or your country’s school ending) to an allow list. It matches every domain that ends with it.

Does it work with the email confirmation box? Yes. The rule checks the address when “Enable Email Confirmation” is on, and version 1.1 also fixes the site-wide domain check for those fields.

Can a visitor get around the rule? The rule is checked on your server when the form is submitted, so turning off JavaScript or editing the page does not skip it.

Will updating change my existing forms? No. Every Email field starts on “Use the add-on settings”, which works exactly as version 1.0. The new rule only applies to fields where you choose one.

Is the address sent to an outside service? Not for domain rules: they are checked on your own server. An address is only sent out when you choose the Kickbox or ZeroBounce validator in the add-on settings.

Read the full Email Validator documentation for every setting, or get the Gravity Forms Email Validator add-on and give each Email field the domain rule it needs.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr