note 9306 added to getmxrr

From: Date: Fri, 27 Oct 2000 09:05:48 +0000
Subject: note 9306 added to getmxrr
Groups: php.notes 
Request: Send a blank email to php-notes+get-7040@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; } http://www.php.net/manual/function.getmxrr.php

« previous php.notes (#7040) next »