danepete / drupal-user-email-domain
Drupal module that restricts user email addresses to a configurable list of approved domains during registration and profile editing, with override permissions for administrators.
Package info
github.com/DanePete/drupal-user-email-domain
Type:drupal-module
pkg:composer/danepete/drupal-user-email-domain
v1.2.0
2026-04-15 18:02 UTC
Requires
- drupal/core: ^10.3 || ^11
README
A Drupal module that restricts user email addresses to approved domains during registration and profile editing.
Features
- Domain allowlist -- configure approved email domains (e.g.
example.org, example.com) via a simple admin form. - Registration and profile enforcement -- validates the email field on both
user_register_formanduser_form. - Admin override permission -- users with the
override useremaildomainpermission can bypass the restriction. - Locked email for non-matching users -- if an admin previously set an email outside the approved domains, the user cannot change it themselves.
- Custom help text -- configurable description shown on the email field.
- Multi-address handling -- gracefully handles input with multiple addresses, accepting the first valid one.
- Logging -- logs attempts to use unapproved domains to the watchdog.
Requirements
- Drupal 10.3+ or 11.x
- PHP 8.1+
Installation
Add the repository to your project's composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/DanePete/drupal-user-email-domain"
}
]
}
Then install:
composer require danepete/drupal-user-email-domain drush en useremaildomain
Configuration
Administration > Configuration > People > User Email Domains (/admin/config/people/useremaildomain)
Enter approved email domains separated by commas. Leave empty to allow all domains.
Permissions
| Permission | Description |
|---|---|
| Administer user email domains | Define which domains are permitted in user email addresses. |
| Override user email domain restrictions | Bypass the domain allowlist when registering or editing a user. |
License
GPL-2.0-or-later