Philip J. Newman wrote: > How would i check that an e-mail has the right parts in it. for example.
> username @ domain . ext > Thanks > / Jim Bob Many people just check it like this: if (strpos($emailVar), '@') > 0) { echo 'Email is validated'; } else { echo 'Please supply a correct email address, don\'t you try no fancy stuff with me!'; } But this function from the pear class Validate, is more complete (can even check the domain): function validateEmail($email, $check_domain = false) { if (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'. '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)) { if ($check_domain && function_exists('checkdnsrr')) { list (, $domain) = explode('@', $email); if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) { return true; } return false; } return true; } return false; } Cheers! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php