JOAOSANTACRUZ.COM

Email validation

Email validation function


						

function check_email($email_address) {
        $pattern = "/^[w-]+(.[w-]+)*@";
        $pattern. = "([0-9a-z][0-9a-z-]*[0-9a-z].)+([a-z])$/i";
        if (preg_match($pattern, $email_address)) {
            $parts = explode("@", $email_address);
            if (checkdnsrr($parts[1], "MX")) {
                return (1); // return true;
            } else { >
                return (0);
                // return false; > }
            } else {
                return (0);
                // return false;
            }
        }

Go Back