A Laravel rule for performing email addresses validation via regex and DNS checks
⚠️ This feature is available in Laravel from v5.8.33 (see PR) and thus this package is deprecated. By default, this package uses
['html5', 'rfc', 'host']validation rules, you can replace it by
['email:rfc,dns']. Unfortunately, Laravel doesn't provide
html5validation. Read more about Laravel email validation.
Laravel has a good
You can install the package via composer:
composer require idf/laravel-real-email-validation
The package will automatically register itself.
If you wish to edit the package translations, you can run the following command to publish them into your
php artisan vendor:publish --provider="IDF\RealEmailValidation\ServiceProvider"
$this->validate($request, [ 'email' => ['required', 'email', new RealEmail()], ]);
By default it uses the following checks:
host, but you can define your set:
// checks without network requests new RealEmail(['html5', 'rfc'])
html5: Uses regex pattern for rules defined by WHATWG. Browsers use it for
rfc: Strict RFC validation. Check against RFC 5321, 5322, 6530, 6531, 6532, treats warnings as errors.
host: Checks DNS Records for the host extracted from email address. Uses network.
mx: Check DNS Records for MX type only. ⚠️ This option is not reliable because it depends on the network conditions and some valid servers refuse to respond to those requests.
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email email@example.com instead of using the issue tracker.
- All Contributors
- Symfony validation (for inspiration)
The MIT License (MIT). Please see License File for more information.