2017 © Pedro Peláez
 

library validate-email

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

image

service-to/validate-email

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  • Wednesday, December 13, 2017
  • by ServiceTo
  • Repository
  • 2 Watchers
  • 4 Stars
  • 144 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 10 Versions
  • 3 % Grown

The README.md

ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records., (*1)

Tired of those pesky fake email addresses in your submission forms?

Add this little bit of majesty to your form validation rules and your server will connect to the MX records and test the validity of the address the user has entered., (*2)

It typically only takes a moment to validate a working address and when an invalid address is entered it takes longer, which can be a win, slowing down annoying script kiddies., (*3)

Usage

Install using composer...

composer require "service-to/validate-email"

In a Laravel Controller

use ServiceTo\ValidateEmail;

public function store(Request $request) {
    $validateemail = new ValidateEmail;
    try {
        if (!$validateemail->test($request->input("email"))) {
            return redirect()->back()->withErrors(["email" => "Invalid Email Address"])
        }
    }
    catch (\ServiceTo\ValidateEmailException $vee) {
        return redirect()->back()->withErrors(["email" => "Invalid Email Address (" . $vee->getMessage() . ")"])
    }

    // rest of checks...
}

In plain old PHP

require_once("vendor/autoload.php");
use ServiceTo\ValidateEmail;

$errors = array();
$validateemail = new ValidateEmail;
try {
    if (!$validateemail->test($_REQUEST["email"])) {
        $errors["email"] = "Invalid Email Address";
    }
}
catch (ServiceTo\ValidateEmailException $vee) {
    $errors["email"] = "Invalid Email Address (" . $vee->getMessage() . ")";
}

if (count($errors) > 0) {
    // don't move on from here, give the user back some errors...
    header("Content-type: application/json");
    echo(json_encode(array("response" => "error", "errors" => $errors)));
    exit();
}

The Versions

13/12 2017

dev-master

9999999-dev https://github.com/ServiceTo/ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mail email validation validate mx

13/12 2017

1.0.9

1.0.9.0 https://github.com/ServiceTo/ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mail email validation validate mx

15/08 2016

1.0.8

1.0.8.0 https://github.com/ServiceTo/ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mail email validation validate mx

15/08 2016

1.0.7

1.0.7.0 https://github.com/ServiceTo/ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mail email validation validate mx

19/11 2015

1.0.6

1.0.6.0 https://github.com/ServiceTo/ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mail email validation validate mx

19/11 2015

1.0.5

1.0.5.0 https://github.com/ServiceTo/ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mail email validation validate mx

17/08 2015

1.0.4

1.0.4.0 https://github.com/ServiceTo/ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mail email validation validate mx

03/06 2015

1.0.3

1.0.3.0 https://github.com/ServiceTo/ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mail email validation validate mx

03/06 2015

1.0.2

1.0.2.0 https://github.com/ServiceTo/ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mail email validation validate mx

03/06 2015

1.0.1

1.0.1.0 https://github.com/ServiceTo/ValidateEmail

Library to validate an email address against its mail servers by doing a name server lookup and then connecting to its MX records.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

mail email validation validate mx