Permalink
Browse files

Updating deep email validation to check and use 'getmxrr' or 'checkdn…

…srr' if either function exists
  • Loading branch information...
ADmad committed Jan 4, 2010
1 parent 2ace6bb commit 9d5015882fca967cf8f135ed2dd76b6725212c28
Showing with 7 additions and 2 deletions.
  1. +7 −2 cake/libs/validation.php
View
@@ -501,8 +501,13 @@ function email($check, $deep = false, $regex = null) {
}
if ($return === true && preg_match('/@(' . $_this->__pattern['hostname'] . ')$/i', $_this->check, $regs)) {
- $host = gethostbynamel($regs[1]);
- return is_array($host);
+ if (function_exists('getmxrr')) {
+ return getmxrr($regs[1], $mxhosts);
+ }
+ if (function_exists('checkdnsrr')) {
+ return checkdnsrr($regs[1], 'MX');
+ }
+ return is_array(gethostbynamel($regs[1]));
}
return false;
}

0 comments on commit 9d50158

Please sign in to comment.