note 8437 deleted from function.ereg by jimw

From: Date: Fri, 02 Nov 2001 01:21:48 +0000
Subject: note 8437 deleted from function.ereg by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20122@lists.php.net to get a copy of this message
Again about testing for valid emails... Using methods described above, namely the one from r.garcia@netia.net for checking the email and the tstrum@salter.com for using getmxrr(), I composed this modified function below. Please not that getmxrr() will not properly work with people at my host, boas.anthro.mnsu.edu. I don't know why, but the getmxrr() fails, and I know I set up accounts on this machine. Also, it now checks for .mil and .arpa. You'll need to modify this when the new top-level domains are added (early 2001, I think). This function also has slightly stricter checking than the ones before. function valid_email ($email) { if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](g|l|m|pa|t|u|v)?$", $email, $check)) { // return TRUE; // I return TRUE here since getmxrr() doesn't work well for me if (getmxrr(substr(strstr($email, '@'), 1), $hosts_found)) { return TRUE; } } return FALSE; }

« previous php.notes (#20122) next »