ฟังค์ชันตรวจสอบอีเมลล์ด้วย PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function validate_email($email){ global $emailerror; $exp = "^[a-z\'0-9]+([._-][a-z\'0-9]+)*@([a-z0-9]+([._-][a-z0-9]+))+$"; if(eregi($exp,$email)){ if(checkdnsrr(array_pop(explode("@",$email)),"MX")){ return true; }else{ $emailerror = "Domain does not exist "; return false; } }else{ $emailerror = "Invalid email format "; return false; } } |