mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-30 23:01:52 +00:00
Improved the email validator by making sure the domain name is valid.
This commit is contained in:
parent
42637ed954
commit
ae7716c900
@ -497,7 +497,12 @@ class Validator
|
||||
*/
|
||||
protected function validateEmail($field, $value)
|
||||
{
|
||||
return filter_var($value, \FILTER_VALIDATE_EMAIL) !== false;
|
||||
if (filter_var($value, \FILTER_VALIDATE_EMAIL) !== false) {
|
||||
$domain = idn_to_ascii(ltrim(stristr($value, '@'), '@'), 0, INTL_IDNA_VARIANT_UTS46) . '.';
|
||||
if (checkdnsrr($domain, 'ANY')) {return true;}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user