Joined: Tue Mar 27, 2007 10:55 pm Posts: 2279 Location: Earth Has thanked: 39 time Have thanks: 61 time
if you have a form for user registration and you want to check the user mail ,if it valid or not ,it is easy just use the following check . Note : the check here is based one the "Regular Expression"
Code:
<?php if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email)) { return FALSE; }
?>
or put it in php function
Code:
<?php function checkmail($email){ return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email); }
Above , i didn't check the domain name ! . you just checked expression
Code:
mailname@domainname.xxx
so programmer make more checking , by checking on the domain name if it valid or not , below you can see an example for this .