Check email
Writer: Christophe Wolfs
Published: 25 April 2008Here is a script that check if a e-mail address is vallid.
You can even check if the domain name is real.
But that part doesn't work on windows and can take some time.
It doesn't allow those special domain extention such as '.museum'.
If you want you can increase the length from 4 to 5 (or more)<?php //Checks that the given string is an email function check_email($email) { //pattern of how a normal e-mail address should look like. $pattern='^[A-Z0-9._-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$'; if(eregi($pattern,$email)) { //this funtion can take some time and consume some resources!! //it also doesnt work on windows (checkdnsrr()) //if(check_host_exists($email)); return true; //else return false; } else return false; } //this funtion can take some time and consume some resources!! //it also doesnt work on windows (checkdnsrr()) function check_host_exists($email) { $array=explode("@",$email); if(checkdnsrr($array[1],"MX")) return true; //host exist else return false; //host doesnt exists } ?>