Skip to content

Instantly share code, notes, and snippets.

@sdeluce
Last active January 4, 2016 01:28
Show Gist options
  • Select an option

  • Save sdeluce/8548270 to your computer and use it in GitHub Desktop.

Select an option

Save sdeluce/8548270 to your computer and use it in GitHub Desktop.
Vérifier une adresse mail
<?php
function is_valid_email($email, $test_mx = false) {
if(eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email))
if($test_mx)
{
list($username, $domain) = split("@", $email);
return getmxrr($domain, $mxrecords);
}
else
return true;
else
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment