I do it like this:


    if (eregi("^[a-z0-9]+([\.%!][_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",
$email))
    {
      list($user, $host) = explode("@", $email);
      if ( !checkdnsrr($host, "MX") )
      return TRUE;
    }
    else
    {
      return FALSE;
    }
  }

As you can see, the email can "look" right, but domain isn't valid. So you
can check DNS record for MX domain.
Next step is to connect to mail server and verify user, but usualy that
takes time and it's better to send some kind of auth code to that mail and
if user conforms it, you can use it...

This worked very well. For any of you out there that are looking for a
simple verification with host dns lookup, here it is!!!

For a more comprehensive "class" check here, thanks to Manuel Lemos

http://www.phpclasses.org/emailvalidation

Reply via email to