Skip to content

Commit

Permalink
Changing how email validation methods are applied, to fix issues wher…
Browse files Browse the repository at this point in the history
…e getmxrr() exists but the domain being validated does not have MX records correctly configured. Fixes #634
  • Loading branch information
markstory committed May 7, 2010
1 parent 45d052b commit 1c1c511
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cake/libs/validation.php
Expand Up @@ -501,11 +501,11 @@ function email($check, $deep = false, $regex = null) {
}

if ($return === true && preg_match('/@(' . $_this->__pattern['hostname'] . ')$/i', $_this->check, $regs)) {
if (function_exists('getmxrr')) {
return getmxrr($regs[1], $mxhosts);
if (function_exists('getmxrr') && getmxrr($regs[1], $mxhosts)) {
return true;
}
if (function_exists('checkdnsrr')) {
return checkdnsrr($regs[1], 'MX');
if (function_exists('checkdnsrr') && checkdnsrr($regs[1], 'MX')) {
return true;
}
return is_array(gethostbynamel($regs[1]));
}
Expand Down

0 comments on commit 1c1c511

Please sign in to comment.