From 9d5015882fca967cf8f135ed2dd76b6725212c28 Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 5 Jan 2010 03:04:46 +0530 Subject: [PATCH] Updating deep email validation to check and use 'getmxrr' or 'checkdnsrr' if either function exists --- cake/libs/validation.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cake/libs/validation.php b/cake/libs/validation.php index 88a641d1b..7aecc7138 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -501,8 +501,13 @@ class Validation extends Object { } 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; }