E-mail validation in php? [duplicate]
Possible Duplicates:
PHP email validation function Is there a php library for email address validation?
I have a contact form on my site but I need a e-mail validation and I don't know how to do it.
$email = "someone@example.com";
if(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
echo "E-mail is not valid";
}
else
{
echo "E-mail is valid";
}
This is probably the simplest method. The example I pasted above is from http://www.w3schools.com/php/filter_validate_email.asp and complete documentation on using filter_var is available at http://us2.php.net/manual/en/function.filter-var.php
my old good friend Google have me some interesting links:
http://www.spoono.com/php/tutorials/tutorial.php?id=41
http://www.linuxjournal.com/article/9585
http://www.plus2net.com/php_tutorial/php_email_validation-ajax.php
http://www.devshed.com/c/a/PHP/Email-Address-Verification-with-PHP/1/
精彩评论