Posted By

sadus on 02/17/11


Tagged

email mx validate


Versions (?)

Email validation with MX check


 / Published in: PHP
 

found this somewhere online...not the author, but works like a charm

  1. function checkEmail($email) {
  2. if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $email)){
  3. list($username,$domain)=split('@',$email);
  4. if(!checkdnsrr($domain,'MX')) {
  5. return false;
  6. }
  7. else {
  8. return true;
  9. }
  10. }
  11. }

Report this snippet  

You need to login to post a comment.