Posted By

level09 on 08/18/09


Tagged


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

vali29
rickfu
umang_nine
ReeceMarsland
userpiv


Validate Email Address


 / Published in: PHP
 

  1. function is_valid_email($email, $test_mx = false)
  2. {
  3. if(eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email))
  4. if($test_mx)
  5. {
  6. list($username, $domain) = split("@", $email);
  7. return getmxrr($domain, $mxrecords);
  8. }
  9. else
  10. return true;
  11. else
  12. return false;
  13. }

Report this snippet  

You need to login to post a comment.