Skip to content

Instantly share code, notes, and snippets.

@henrikbjorn
Forked from tcarlsen/gist:577213
Created September 13, 2010 13:54
Show Gist options
  • Save henrikbjorn/577311 to your computer and use it in GitHub Desktop.
Save henrikbjorn/577311 to your computer and use it in GitHub Desktop.
<?php
function checkEmail($email) {
// checks proper syntax
if(preg_match("/^([a-z])([a-z0-9._])+([a-z0-9])\@([a-z0-9])*([a-z])+(-[a-z])*([a-z0-9])*(\.([a-z0-9])*([a-z])+(-[a-z])*([a-z0-9])*)+$/i" , $email)) {
// gets domain name
list($username, $domain) = split('@', $email);
// checks for if MX records in the DNS
if(checkdnsrr($domain, 'MX')) {
return true;
}
}
return false;
}
@henrikbjorn
Copy link
Author

http://gist.github.com/577311 lidt pænere og burde virke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment