Skip to content

Instantly share code, notes, and snippets.

@jotapepinheiro
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jotapepinheiro/9356952 to your computer and use it in GitHub Desktop.
Save jotapepinheiro/9356952 to your computer and use it in GitHub Desktop.
Validar e-mail e domínio.
<?php
function validaEmail($email){
if(filter_var($email, FILTER_VALIDATE_EMAIL))
{
$separa = list($usuario, $provedor) = explode('@', $email);
if(getmxrr($separa[1], $mx_records, $mx_weight))
return $separa[0].'@'.$separa[1];
else
return false;
}
return false;
}
echo validaEmail('seuemail@dominio.com.br');//false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment