Skip to content
Small PHP library to valid email addresses using a number of methods.
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
src Ensure $email is a string. Aug 9, 2016
tests Ensure $email is a string. Aug 9, 2016
.travis.yml Added Travis CI. Nov 11, 2014
composer.lock Updated dependancies. Dec 15, 2015

Email Validator

Small PHP library to valid email addresses using a number of methods.

License Build Status Code Quality Downloads Github Stars


  • Validates email address
  • Checks for example domains (e.g.
  • Checks for disposable email domains (e.g.
  • Checks for role-based addresses (e.g. abuse@)
  • Checks for MX records (i.e. can receive email)

Install (using Composer)

composer require nojacko/email-validator:~1.0


Generalised Functions

  • isValid($email) Runs all the tests within this library. Returns true or false.
  • isSendable($email) Checks isEmail, isExample and hasMx. Returns true or false.

Specific Functions

If you want more control, use these functions seperately.

  • isEmail($email) Note: returns true or false only.
  • isExample($email)
  • isDisposable($email)
  • isRole($email)
  • hasMx($email)

These functions take a single argument (an email address) and return:

  • true, when function name is satisfied.
  • false, when function name is not satisfied.
  • null, when check is not possible, i.e. an invalid email is given.


$validator = new \EmailValidator\Validator();

$validator->isValid('');              // true
$validator->isValid('');                // false
$validator->isValid('');             // false

$validator->isSendable('');           // true
$validator->isSendable('');             // true
$validator->isSendable('');          // false

$validator->isEmail('');             // true
$validator->isEmail('example@example');                 // false

$validator->isExample('');           // true
$validator->isExample('');            // false
$validator->isExample('');                   // null

$validator->isDisposable('');        // false
$validator->isDisposable('');     // true
$validator->isDisposable('');                // null

$validator->isRole('');              // false
$validator->isRole('');                // true
$validator->isRole('');                      // null

$validator->hasMx('');               // false
$validator->hasMx('');                // true
$validator->hasMx('');                       // null


Contributions welcome!


Add/Remove Disposable Domain

See the email-data-disposable project.

New Feature

If you're planning a new feature, please raise an issue first to ensure it's in scope. The aim is to keep this library small and with one specific purpose.

Other Contributions

For anything that isn't a new feature (bug fix, tests, etc) just create a pull request.


Test are all located in tests folder.

Run tests with phpunit. In root folder, execute phpunit in a CLI.


Semantic Versioning 2.0.0


The MIT License (MIT). See LICENCE file.

You can’t perform that action at this time.