Return to Snippet

Revision: 41366
at February 17, 2011 02:50 by sadus


Initial Code
function checkEmail($email) {
    if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $email)){
        list($username,$domain)=split('@',$email);
        if(!checkdnsrr($domain,'MX')) {
            return false;
        }
        else {
            return true;
        }
    }
}

Initial URL

                                

Initial Description
found this somewhere online...not the author, but works like a charm

Initial Title
Email validation with MX check

Initial Tags
email

Initial Language
PHP