note 9306 deleted from function.getmxrr by jimw

From: Date: Fri, 14 Dec 2001 20:32:47 +0000
Subject: note 9306 deleted from function.getmxrr by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22751@lists.php.net to get a copy of this message
A common use of this function is to check the validity of an email address. Through trial and error, I have found that this works fairly well, although it does not check for the existence of the actual user; rather, it verifies the existence of any and all domains associated with the address. function email_is_valid ($email) { if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$", $email, $check)) { if ( getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp) ) { return TRUE; } // THIS WILL CATCH DNSs THAT ARE NOT MX. if(checkdnsrr(substr(strstr($check[0], '@'), 1),"ANY")){ return TRUE; } } return FALSE; }

« previous php.notes (#22751) next »