mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-09-11 10:36:45 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 54859fabea | |||
| 135444003f | |||
| 9dde0df1e3 |
@@ -18,6 +18,13 @@ class DNSCheckValidation implements EmailValidation
|
|||||||
* @var InvalidEmail
|
* @var InvalidEmail
|
||||||
*/
|
*/
|
||||||
private $error;
|
private $error;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
if (!extension_loaded('intl')) {
|
||||||
|
throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function isValid($email, EmailLexer $emailLexer)
|
public function isValid($email, EmailLexer $emailLexer)
|
||||||
{
|
{
|
||||||
@@ -44,7 +51,11 @@ class DNSCheckValidation implements EmailValidation
|
|||||||
|
|
||||||
protected function checkDNS($host)
|
protected function checkDNS($host)
|
||||||
{
|
{
|
||||||
$host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46), '.') . '.';
|
$variant = INTL_IDNA_VARIANT_2003;
|
||||||
|
if ( defined('INTL_IDNA_VARIANT_UTS46') ) {
|
||||||
|
$variant = INTL_IDNA_VARIANT_UTS46;
|
||||||
|
}
|
||||||
|
$host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.') . '.';
|
||||||
|
|
||||||
$Aresult = true;
|
$Aresult = true;
|
||||||
$MXresult = checkdnsrr($host, 'MX');
|
$MXresult = checkdnsrr($host, 'MX');
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class SpoofCheckValidation implements EmailValidation
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
if (!class_exists(Spoofchecker::class)) {
|
if (!extension_loaded('intl')) {
|
||||||
throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
|
throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ With the help of [PHPStorm](https://www.jetbrains.com/phpstorm/)
|
|||||||
## Requirements ##
|
## Requirements ##
|
||||||
|
|
||||||
* [Composer](https://getcomposer.org) is required for installation
|
* [Composer](https://getcomposer.org) is required for installation
|
||||||
* [Spoofchecking](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php) validation requires that your PHP system have the [PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php) (also known as PHP Intl)
|
* [Spoofchecking](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php) and [DNSCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/DNSCheckValidation.php) validation requires that your PHP system have the [PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php) (also known as PHP Intl)
|
||||||
|
|
||||||
## Installation ##
|
## Installation ##
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user