Last active
January 4, 2016 01:28
-
-
Save sdeluce/8548270 to your computer and use it in GitHub Desktop.
Vérifier une adresse mail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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