salaros / is-biz-mail
isBizMail tells you whether a given email address is free (gmail.com, yahoo.es, yandex.ru etc) or not
Fund package maintenance!
Patreon
Liberapay
www.paypal.me/salarosUSA
Installs: 405 362
Dependents: 0
Suggesters: 0
Security: 0
Stars: 31
Watchers: 2
Forks: 10
Open Issues: 0
Requires
- php: ~5.4 || ~7.0 || ~8.0
Requires (Dev)
- php-coveralls/php-coveralls: ^1 || ^2
- phpunit/phpunit: ^4.8 || ^5.7 || ^6.5 || ^7.0 || ^8.0 || ^9.0
- symplify/easy-ci: ^11.0
README
Business Email Checker
isBizMail tells you whether a given email address is free (gmail.com, yahoo.es, yandex.ru etc) or not. The list of emails used by isBizMail is taken from hereยน. Detects around 2500 domains and subdomains.
- All credits for the list itself go to SpamAssasin authors and contributors
Looking for JavaScript, .NET etc?
- JavaScript implementation (Vanilla / CommomJS module)
- .NET implementation (.NET Standard 2.0+)
๐๐๐ Support this project ๐๐๐
You can support us in a small way, please consider starring and sharing this repo! It helps us getting known and grow the community.
Installation
You can install isBizMail via Composer:
composer require salaros/is-biz-mail
or by adding it directly to your composer.json
file:
{ "require": { "salaros/is-biz-mail": "*" } }
Then use it like this:
<?php require 'path/to/vendor/autoload.php'; use Salaros\Email\IsBizMail; (new IsBizMail())->isValid('foo@bar.com'); // true // You can use static access as well IsBizMail::isValid('hello@gmail.com'); // false // ...
You can easily drop it into your Yii2 model's rules:
public function rules() { return [ // ... [['email'], 'isBusinessEmail'], // ... ]; } public function isBusinessEmail($attributeName, $params) { $isBussiness = (new IsBizMail())->isValid($this->email); if (!isBussiness) $this->addError($attributeName, 'Mail boxes such as @gmail.com, @yahoo.com etc are not allowed!'); return $isBussiness; }
Testing: PHPUnit
composer install composer test # or ./vendor/bin/phpunit