Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…srr' if either function exists
  • Loading branch information...
commit 9d5015882fca967cf8f135ed2dd76b6725212c28 1 parent 2ace6bb
ADmad ADmad authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 cake/libs/validation.php
9 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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.