Skip to main content

How to Block Non-Business Email Addresses

Implement custom validation that prevents users from submitting personal email domains.

Updated over 8 months ago

In Formulayt, custom validation rules can be added to fields in the Fields management area. Each validation rule must take the form of a valid regular expression. This guide shows you how to block specific email domains.

Setting up email domain validation

To block personal email domains:

  1. Open the email field and click Add a validator

  2. Configure your validator with:

    • A descriptive name for your custom validator

    • The regular expression to execute the validation

    • A clear error message that will display when validation fails

Regular expression for blocking email domains

Here is an example regular expression to block specific email domains:

.+@(?!example1\.|example2\.|example3\.)

The domains are added in this section: example1. example2. and example3.

Important formatting notes:

  • Domains must be pipe separated

  • Each period must be preceded by a backslash

  • This will match any TLD variant (example1.co.uk or example1.com would both be blocked)

Example for blocking common personal email domains

Here is a ready-to-use expression for blocking common personal email providers:

.+@(?!gmail\.|hotmail\.|me\.|ymail\.|yahoo\.|mac\.|live\.|me\.|msn\.|outlook\.)

Testing and user experience

Always test validation rules in preview mode before publishing to ensure they work as intended and don't inadvertently prevent valid submissions.

Provide clear error messages that explain exactly what users need to do:

βœ… Good: "Please enter a business email address"


❌ Poor: "Email address not valid"

Did this answer your question?