PHPackages                             magenettic/module-email-validation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. magenettic/module-email-validation

ActiveMagento2-module[Validation &amp; Sanitization](/categories/validation)

magenettic/module-email-validation
==================================

Email validation rules for Magento 2

1.0.0(1mo ago)11↑2900%MITPHPPHP &gt;=8.2

Since Apr 25Pushed 1mo agoCompare

[ Source](https://github.com/magenettic/module-email-validation)[ Packagist](https://packagist.org/packages/magenettic/module-email-validation)[ RSS](/packages/magenettic-module-email-validation/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Magenettic\_EmailValidation
===========================

[](#magenettic_emailvalidation)

Email validation rules module for Magento 2.4.x

Overview
--------

[](#overview)

This module adds custom email validation rules for customer registration, allowing merchants to block or allow specific email domains and addresses.

Features
--------

[](#features)

### 1. Blocked Email Domains (Blacklist)

[](#1-blocked-email-domains-blacklist)

Rejects customer registrations with emails from specified domains.

**Example:** If `terminator.com` is in the blacklist, any email like `john@terminator.com` will be rejected.

### 2. Allowed Email Domains (Whitelist)

[](#2-allowed-email-domains-whitelist)

Stores a list of allowed email domains.

**Example:** If `company.com` is in the whitelist, emails like `john@company.com` will be allowed.

### 3. Force Whitelist

[](#3-force-whitelist)

When enabled, **only** emails from domains in the whitelist will be accepted. All other domains will be blocked.

### 4. Blocked Emails (Blacklist)

[](#4-blocked-emails-blacklist)

Rejects specific email addresses completely.

**Example:** If `spam@example.com` is in the list, this exact email will be rejected even if the domain is not blocked.

Configuration
-------------

[](#configuration)

Navigate to: **Stores &gt; Settings &gt; Configuration &gt; Customers &gt; Customer Configuration &gt; Email Validation**

SettingDescription**Enable Email Validation**Enable/disable the module**Blocked Email Domains**Enter domains one per line (e.g., `terminator.com`)**Allowed Email Domains**Enter allowed domains one per line**Force Whitelist**When enabled, only whitelist domains are accepted**Blocked Emails**Enter complete emails one per lineRequirements
------------

[](#requirements)

- Magento 2.4.x
- PHP 8.2+

Installation
------------

[](#installation)

Inform the repository in you composer.json

```
"repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/magenettic/module-email-validation.git"
    }
  ],
```

Run composer installation

```
composer require magenettic/module-email-validation
```

Run the magento CLI commands

```
bin/magento module:enable Magenettic_EmailValidation
bin/magento setup:upgrade
bin/magento cache:flush
```

Validation Flow
---------------

[](#validation-flow)

```
Customer submits email
    |
    v
Check if email is in blocked emails list
    |
    v
Check if domain is in blocked domains list
    |
    v
Check if Force Whitelist is enabled
    |-- No  --> Allow domain (unless blocked)
    |
    +-- Yes --> Check if domain is in allowed domains list
                  |-- Yes --> Allow email
                  +-- No  --> Reject email

```

Examples
--------

[](#examples)

### Scenario 1: Block a specific domain

[](#scenario-1-block-a-specific-domain)

```
Blocked Domains: terminator.com
Force Whitelist: No

user@terminator.com --> REJECTED
user@gmail.com      --> ALLOWED

```

### Scenario 2: Allow only specific domains

[](#scenario-2-allow-only-specific-domains)

```
Allowed Domains: company.com, partner.org
Force Whitelist: Yes

user@company.com    --> ALLOWED
user@partner.org    --> ALLOWED
user@gmail.com      --> REJECTED

```

### Scenario 3: Block specific email

[](#scenario-3-block-specific-email)

```
Blocked Emails: spam@spammer.com, test@test.com
Force Whitelist: No

spam@spammer.com    --> REJECTED
test@test.com       --> REJECTED
user@gmail.com      --> ALLOWED

```

Testing
-------

[](#testing)

### Unit Tests

[](#unit-tests)

The module includes comprehensive unit tests covering:

- **Helper/DataTest.php** - Tests for configuration parsing and validation logic
- **Plugin/BeforeEmailValidatorPluginTest.php** - Tests for email validation plugin

#### Run Tests

[](#run-tests)

```
vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist app/code/Magenettic/EmailValidation/Test/Unit/
```

#### Test Results

[](#test-results)

```
27 tests, 61 assertions - OK

```

### Test Coverage

[](#test-coverage)

ComponentTestsCoverageHelper\\Data18 testsisEnabled, isWhitelistForced, getBlockedDomains, getAllowedDomains, getBlockedEmails, extractDomain, isDomainBlocked, isDomainAllowed, isEmailBlockedPlugin\\BeforeEmailValidatorPlugin8 testsbeforeCreateAccountWithPasswordHash, beforeCreateAccountModule Structure
----------------

[](#module-structure)

```
Magenettic/EmailValidation/
├── Helper/Data.php                    # Configuration helper
├── Plugin/
│   ├── BeforeEmailValidatorPlugin.php  # Blocks registration
│   └── AroundEmailValidatorPlugin.php  # Global validation
├── Test/Unit/
│   ├── Helper/DataTest.php
│   └── Plugin/BeforeEmailValidatorPluginTest.php
├── etc/
│   ├── adminhtml/system.xml           # Configuration fields
│   ├── di.xml                         # Plugin registration
│   └── module.xml                     # Module declaration
├── composer.json
├── README.md
└── registration.php

```

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance89

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

55d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f83d5ebe7e1574accc3ffacf62101d3a8026a34b8324f9abf1b20957e9ffe546?d=identicon)[elieldepaula](/maintainers/elieldepaula)

---

Top Contributors

[![elieldepaula](https://avatars.githubusercontent.com/u/1477320?v=4)](https://github.com/elieldepaula "elieldepaula (2 commits)")

### Embed Badge

![Health badge](/badges/magenettic-module-email-validation/health.svg)

```
[![Health](https://phpackages.com/badges/magenettic-module-email-validation/health.svg)](https://phpackages.com/packages/magenettic-module-email-validation)
```

###  Alternatives

[mollie/magento2

Mollie Payment Module for Magento 2

1131.8M12](/packages/mollie-magento2)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1010.0k22](/packages/loki-magento2-components)[imi/magento2-friendly-captcha

Friendly Captcha integration for Magento2

19125.8k](/packages/imi-magento2-friendly-captcha)[mage-os/module-inventory-reservations-grid

Add a grid with the list of inventory reservations.

1512.6k](/packages/mage-os-module-inventory-reservations-grid)[loki/magento2-admin-components

Admin Panel grids and forms created via Loki Components

173.7k7](/packages/loki-magento2-admin-components)[elgentos/magento2-improved-customer-address-validation

Magento 2 module to disable or adjust customer address field validation such as street, city and telephone

1718.8k](/packages/elgentos-magento2-improved-customer-address-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
