From 1c1c51185309f89d22a6ce7a9cc999354e50c7e5 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 6 May 2010 21:43:58 -0400 Subject: [PATCH] Changing how email validation methods are applied, to fix issues where getmxrr() exists but the domain being validated does not have MX records correctly configured. Fixes #634 --- cake/libs/validation.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cake/libs/validation.php b/cake/libs/validation.php index 4b732f25e84..5169451036c 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -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])); }