# Elementor Forms: Require a Business Email Address

> Rejects Elementor Pro form submissions that use free email providers such as Gmail or Yahoo, with a clear message under the field, for B2B lead forms.

- Type: PHP
- Runs: Run everywhere
- Category: [Page Builders & Themes](https://wpide.com/library/category/page-builders/)
- Tags: elementor, forms, validation, email
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/elementor-form-block-free-email/

## Code

```php
// Free email domains to refuse.
$wpide_el_free_domains = array( 'gmail.com', 'googlemail.com', 'yahoo.com', 'hotmail.com', 'outlook.com', 'live.com', 'aol.com', 'icloud.com', 'gmx.com', 'mail.com', 'proton.me', 'protonmail.com' );
$wpide_el_free_message = 'Please use your work email address.';

add_action( 'elementor_pro/forms/validation/email', function ( $field, $record, $ajax_handler ) use ( $wpide_el_free_domains, $wpide_el_free_message ) {
    $email = isset( $field['value'] ) ? strtolower( trim( (string) $field['value'] ) ) : '';

    if ( '' === $email || false === strpos( $email, '@' ) ) {
        return;
    }

    $domain = substr( strrchr( $email, '@' ), 1 );

    if ( in_array( $domain, $wpide_el_free_domains, true ) ) {
        $ajax_handler->add_error( $field['id'], $wpide_el_free_message );
    }
}, 10, 3 );
```

## Notes

Applies to every Email field in every Elementor form. Edit the domain list to suit your audience.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Elementor Forms: Require a Business Email Address" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
