Here is a script that actually connects to their mail server to see if its
valid

<?

// Set the form error check to false
$form_errors = array();

//E-Mail address verifications
  // Make Email a required field
  $Email = trim($Email);
    if ($Email == "") {
      $form_errors["required_Email"] = true;
    }
    elseif
(!eregi("^([a-zA-Z0-9._-])+@([a-zA-Z0-9._-])+\.([a-zA-Z0-9._-])([a-zA-Z0-9._
-])+", $Email)) {
      $form_errors["Email_badformat"] = true;
    }
    // Attempt to resolve the MX host
    else {
      list($user, $domain) = split("@", $Email, 2);
      if (! checkdnsrr($domain, "MX")) {
        $form_errors["Email_badhost"] = true;
      }
    }

// Check if there are any errors
if (count($form_errors)) {
  // If the user left the e-mail field blank
  if ($form_errors["required_Email"]) {
    echo("<font color=\"#ff0000\"><b>Your E-mail Address is
required.</b></font>");
  }
  // If the format of the e-mail address is incorrect
  elseif ($form_errors["Email_badformat"]) {
    echo("<font color=\"#ff0000\"><b>Please enter a valid e-mail
address.</b></font>");
  }
  // If the mail server of the address the user provided could not be
contacted
  elseif ($form_errors["Email_badhost"]) {
    echo("<font color=\"#ff0000\"><b>Your E-mail address did not resolve to
a working e-mail server.<br> Please enter a valid e-mail
address.</b></font>");
  }
}
?>


"Marko Mihalec" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> function isEmailInvalid($val)
> {
>  // regex for email validation
>  $pattern =
> "/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/";
>
>   // match?
>   if(preg_match($pattern, $val))
>   {
>   return 0;
>   }
>   else
>   {
>   return 1;
>   }
> }
>
>
>
>
>
>



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to