You would use the $email = trim($email); before you called your function that you found. This way, you get rid of the spaces before you check if it's a valid email. That script you have doesn't really give you much more error than mine would, with a little proper code. And saying the user has to have youremail@yourdomain.com may not be correct, because for me at work, its myname@mortgage.wellsfargo.com (I work with wells fargo). The only thing I would say is wrong with the script you found is the isEmailAddr function. Let me rewrite it for you using the reg expression that I used before. It will return more correct email addresses I would assume...
function isEmailAddr($email){
if(eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*$", $email)){
return 1;
}else{
return 0;
}
}
//and just make sure that you call this next line before you use the above function
$email = trim($email);
Also, I noticed the script you found is javascript... Not that I am against using that for validation or anything, but if the user turned off javascript, they could put in a bad email address... So if I were you, I'd try to validate in php, since it cannot be avoided. Anyways, hope this helps...