-
-
Save alexmazaltov/d382efe2b11bff1b07f3c1b62630d308 to your computer and use it in GitHub Desktop.
Simple email address validation - check syntax and MX record existing.
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
<?php | |
function _nxte_redeem_is_email_valid($email) { | |
if (empty ($email)) {return false;} | |
list($user_name, $mail_domain) = explode('@', $email); | |
if (empty($user_name) || empty($mail_domain)) {return false;} | |
$is_syntax_ok = (bool) filter_var($email, FILTER_VALIDATE_EMAIL); | |
$is_MX_exists = checkdnsrr($mail_domain, 'MX'); | |
return ($is_syntax_ok && $is_MX_exists); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment