note 74651 added to function.checkdnsrr

From: Date: Sat, 21 Apr 2007 19:57:40 +0000
Subject: note 74651 added to function.checkdnsrr
Groups: php.notes 
Request: Send a blank email to php-notes+get-125758@lists.php.net to get a copy of this message
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/ ---- Server IP: 194.145.210.4 Probable Submitter: 82.32.88.140 ---- Manual Page -- http://www.php.net/manual/en/function.checkdnsrr.php Edit -- https://master.php.net/note/edit/74651 Del: integrated -- https://master.php.net/note/delete/74651/integrated Del: useless -- https://master.php.net/note/delete/74651/useless Del: bad code -- https://master.php.net/note/delete/74651/bad+code Del: spam -- https://master.php.net/note/delete/74651/spam Del: non-english -- https://master.php.net/note/delete/74651/non-english Del: in docs -- https://master.php.net/note/delete/74651/in+docs Del: other reasons-- https://master.php.net/note/delete/74651 Reject -- https://master.php.net/note/reject/74651 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125758) next »