Notice - That extracts the MX records from the email address and connect with the mail server to make sure the mail address accurately exist. So it may be slow loading time in local and some co-operate MX records take a long time.
You can install the package via composer:
composer require tintnaingwin/email-checker
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 resources/lang
folder
php artisan vendor:publish --provider="Tintnaingwin\EmailChecker\EmailCheckerServiceProvider"
This package supports:
- Validate with SMTP
- Support for Disposable Email
To add 'email_checker' at email attribute
// [your site path]/app/Http/Requests/RegisterRequest.php
public function rules()
{
return [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users|email_checker',
'password' => 'required|string|min:6|confirmed',
];
}
// [your site path]/app/Http/Controllers/Auth/RegisterController.php
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => 'required|string|email|max:255|unique:users|email_checker',
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
use TintNaingWin\EmailChecker\Rules\EmailExist;
$request->validate([
'email' => ['required', 'string', 'email', 'max:255', 'unique:users', new EmailExist],
]);
You can also check check email manually:
// reture boolean
EmailChecker::check('[email protected]');
Run the tests with:
composer test
- Disposable Email List
Please see CHANGELOG for more information on what has changed recently.
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.