Validate Email and Domain


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.