# Block Disposable Email Addresses at Checkout

> Refuses orders placed with throwaway email services, so order confirmations, downloads and receipts reach a real inbox.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, checkout, email, fraud
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-block-disposable-emails/

## Code

```php
$wpide_disposable_domains = array( 'mailinator.com', 'guerrillamail.com', '10minutemail.com', 'tempmail.com', 'yopmail.com', 'trashmail.com', 'sharklasers.com', 'getnada.com', 'temp-mail.org', 'dispostable.com' );

add_action( 'woocommerce_after_checkout_validation', function ( $data, $errors ) use ( $wpide_disposable_domains ) {
    $email = strtolower( (string) ( $data['billing_email'] ?? '' ) );

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

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

    foreach ( $wpide_disposable_domains as $blocked ) {
        if ( $domain === $blocked || substr( $domain, -strlen( '.' . $blocked ) ) === '.' . $blocked ) {
            $errors->add( 'validation', 'Please use a permanent email address so we can send your order details.' );
            return;
        }
    }
}, 10, 2 );
```

## Notes

Add domains to the list as you spot them; subdomains of listed domains are blocked too.

## How to use it

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