It's nearly impossible to validate an e-mail address as completely valid.
The example given by Mr. Clark is very in-depth and well done. If you are
looking for something a little simpler here's a snippet of code that checks
to see if the format of the email address is valid meaning it contains x
characters, then an @ followed by x character . x characters.
I use this function for my message board to at least validate the e-mail
address the user submits is at least partially correct:
in your main routine just make this call
emailcheck($email);
function emailcheck($email)
{
$valid = ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $email, $trashed);
if($valid)
{
$ismatch = "Yes";
}
else
{
$ismatch = "No";
echo "The e-mail address you entered, $email, appears to be invalid\n";
echo "Please enter a valid e-mail address and resubmit.";
exit;
}
}
I use $ismatch for other purposes but can be omitted and the function can be
changed to simply if(!$valid)
Hope that helps some.
Chad Guilette
----- Original Message -----
From: "Brian Clark" <[EMAIL PROTECTED]>
To: "PHP is not a drug ." <[EMAIL PROTECTED]>
Sent: Tuesday, January 30, 2001 6:38 AM
Subject: Re: [PHP] verify that email exist ?
>
> Hello Website4S,
>
> (Wac == "[EMAIL PROTECTED]") [EMAIL PROTECTED] etched:
>
> Wac> I don`t think it is possible to check that an email actually
> Wac> exists but what
>
> It's possible:
>
> http://phpclasses.upperdesign.com/browse.html/package/13
>
> Class that may be used to determine if a given e-mail address
> is valid.
>
> It features:
>
> - Simple validation just by looking at the e-mail address string.
> - Validation of a e-mail address host as a valid mail exchange domain.
> - Validation of a e-mail address by connecting to the mail host
> server to determine if there is really a deliverable mail box.
>
> -Brian
> --
> Dinner not ready: (A)bort (R)etry (P)izza
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]