[Home] [My Scripts] [Contact] [Business Card Designer] [Donate] [$8.95 Domain Names]

Home > Scripts > Email address validation function

Email address validation function

... feel free to use this script for whatever you like.

Email address validation function

Simple function to validate email addresses.


This function just checks to see if an email address is syntactically correct. It doesn't verify that the address actually exists.

I didn't create this myself, but found it on the net ages ago.


if( validate_email($email) == true ){
"Yay! $email is valid!";
"Sorry, $email is not a valid email address.";


function validate_email($email){
   if (
eregi("(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)", $email) ||
eregi ("^.+\@(\[?)[-_a-zA-Z0-9\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$", $email)) {
   } else {
$user, $domain) = explode("@", $email);
      if ((!
eregi("^[_a-zA-Z0-9\.\-]+$", $user)) ||
eregi("^[_a-zA-Z0-9\.\-]+$", $domain))) {
      } else {


[Back] [Top] [Forward]

Powered by php, mySql.

Request processed in 0.00 seconds on Wednesday 26th September 2012 23:43:14.

©2002 Sam Yapp

What do you think of my resume wizard site? All nicely written in php :)