note 9307 deleted from function.checkdnsrr by jimw

From: Date: Fri, 07 Dec 2001 02:20:27 +0000
Subject: note 9307 deleted from function.checkdnsrr by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-21822@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 the domain 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 (#21822) next »