# Block Disposable Email Addresses on Registration

> Rejects registrations from throwaway email services, which are a common source of fake and spam accounts.

- Type: PHP
- Runs: Run everywhere
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: users, registration, spam
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/block-disposable-email-registration/

## Code

```php
// Domains to reject. Add more as you see them in your users list.
$wpide_disposable_domains = array(
    'mailinator.com', 'guerrillamail.com', 'guerrillamail.net', '10minutemail.com', 'tempmail.com', 'temp-mail.org',
    'yopmail.com', 'trashmail.com', 'getnada.com', 'sharklasers.com', 'dispostable.com', 'maildrop.cc',
    'throwawaymail.com', 'fakeinbox.com', 'mintemail.com', 'spamgourmet.com', 'emailondeck.com', 'moakt.com',
);

add_filter( 'registration_errors', function ( $errors, $login, $email ) use ( $wpide_disposable_domains ) {
    $domain = strtolower( (string) substr( strrchr( (string) $email, '@' ), 1 ) );

    foreach ( $wpide_disposable_domains as $blocked ) {
        if ( $domain === $blocked || ( strlen( $domain ) > strlen( $blocked ) && substr( $domain, -strlen( $blocked ) - 1 ) === '.' . $blocked ) ) {
            $errors->add( 'wpide_disposable_email', '<strong>Error:</strong> Please use a permanent email address.' );
            break;
        }
    }

    return $errors;
}, 10, 3 );
```

## Notes

Subdomains of listed domains are blocked as well.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Block Disposable Email Addresses on Registration" 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/
