Created
September 4, 2018 10:17
-
-
Save gelinger777/1a3a3931c5b199978478d0cdfd184f4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function isEmail($email) | |
{ | |
$parsed=explode("@",$email); | |
if(count($parsed)<2){ | |
return false; | |
} | |
else{ | |
$domain=$parsed[1]; | |
if(checkdnsrr($domain)) { | |
// Domain at least has an MX record, necessary to receive email | |
} | |
else{ | |
return false; | |
} | |
} | |
return !empty($email) && preg_match(Tools::cleanNonUnicodeSupport('/^[a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z\p{L}0-9]+(?:[.]?[_a-z\p{L}0-9-])*\.[a-z\p{L}0-9]+$/ui'), $email); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment