note 74651 deleted from function.checkdnsrr by nlopess

From: Date: Tue, 01 May 2007 13:39:43 +0000
Subject: note 74651 deleted from function.checkdnsrr by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126043@lists.php.net to get a copy of this message
Note Submitter: Craig Francis ---- For an extended email check system, then this seems to work quite well. It starts by doing a basic formatting check, then if available, it runs the DNS check on the domain name... so it might not be a good idea to use if running on a server which uses an un-reliable DNS server. <?php function isemail($email) { if (preg_match('/^\w[-.\w]*@(\w[-._\w]*\.[a-zA-Z]{2,}.*)$/', $email, $matches)) { if (function_exists('checkdnsrr')) { if (checkdnsrr($matches[1] . '.', 'MX')) return true; // If a 'mail exchange' record exists if (checkdnsrr($matches[1] . '.', 'A')) return true; // Mail servers can fall back on 'A' records } else { return true; // For Windows } } return false; } ?> http://www.craigfrancis.co.uk/features/code/phpEmailCheck/

« previous php.notes (#126043) next »