Posted By

Jotape on 08/31/11


Tagged

php


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

owenbot


Validate Email and Domain


 / Published in: PHP
 

Verifica se o e-mail e o dominio são válidos.

  1. <?
  2. function validaEmail($email){
  3. if(filter_var($email, FILTER_VALIDATE_EMAIL))
  4. {
  5. $separa = list($usuario, $provedor) = explode('@', $email);
  6. if(getmxrr($separa[1], $mx_records, $mx_weight))
  7. return $separa[0].'@'.$separa[1];
  8. else
  9. return false;
  10. }
  11. return false;
  12. }
  13.  
  14. echo validaEmail('[email protected]');//false
  15.  
  16. echo validaEmail('[email protected]');//true
  17. ?>

Report this snippet  

You need to login to post a comment.