note 4294 deleted from function.mail by jimw

From: Date: Wed, 31 Oct 2001 22:58:45 +0000
Subject: note 4294 deleted from function.mail by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19847@lists.php.net to get a copy of this message
The email checker by m@1a.dk fails on email addresses that have more than one component before the TLD (like somewhere.co.uk, but also something like math.college.edu). This should work better: <PRE> if (eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-\.]+)\.([a-z]{2,3}$)", $email, $check)) { if (getmxrr($check[1] . "." . $check[2]) { return "Valid"; } return "No MX for " . $check[1] . "." . $check[2]; } else { return "Badly formed address"; } </PRE>

« previous php.notes (#19847) next »