imranali / verify-email
Verify email if it exist or not
Requires
- php: >=7.0.0
- laravel/framework: ~5.5.0|~5.6.0|~5.7.0|~5.8.0|~6.0.0
Requires (Dev)
- phpunit/phpunit: ^8.4@dev
This package is auto-updated.
Last update: 2025-03-29 00:47:16 UTC
README
This is a simple package that verify email if it is exist or not, This is useful for those who want to get real Email address from users. Get real email address while registering users, for app or newsletter. You can also check email is exist or not before sending email to users. It prevents from black listing your server, or hard bouncing .
- Save you from hard bouncing
- Most of the companies buy SMTP email subscritpion, they have limited credits, you can use this simple package to save your email credits
1. Requirements
- Laravel 5.5.x to 6.0.x
- PHP >= 7.0
2. Installation
-
Require the package using composer
composer require imranali/verify-email
-
Add the service provider to the
providers
inconfig/app.php
ImranAli\VerifyEmail\VerifyEmailServiceProvider::class
and add
Facade
as alias inapp/config.php
'Verifyemail' => ImranAli\VerifyEmail\Facades\verifyEmailFacade::class,
Laravel 5.5 >= uses package auto discovery, so you do not need to register service provider and Facade manually
-
Publish the configuration
php artisan vendor:publish --provider="ImranAli\VerifyEmail\VerifyEmailServiceProvider"
3. Usage
You have to call checkEmail()
method, it takes one argument which is email address that needs to be validate
Verifyemaill::checkEmail('test@example.com');
It returns true
if email exist otherwise false
This package comes with few configuration, You can change settings accordingly, configuration contains one field from_email
make sure to set valid email address, because this email address will be used to sent request from.
You can also set email at runtime for example using Facade
Verifyemail::setEmailFrom('support@domain.com');
It also has one helper method that can be used to validate email address pattern
Verifyemail::validate('example@domain.com')
Here is a complete demo code
// can also be set email at runtime (optional), it is good to set in config file Verifyemail::setEmailFrom('support@domain.com'); // email address to check $email = 'exampl@domain.com'; if (Verifyemail::checkEmail($email)) { echo 'email <' . $email . '> exist!'; } elseif (Verifyemail::validate($email)) { echo 'email <' . $email . '> valid, but not exist!'; } else { echo 'email <' . $email . '> not valid and not exist!'; }