/** * Validate the domain of an email address by checking if the domain has a * valid MX record. * * @link http://php.net/checkdnsrr not added to Windows until PHP 5.3.0 * * @param string $email email address * @return boolean */ public static function email_domain($email) { if (!Rules::not_empty($email)) { return FALSE; } // Empty fields cause issues with checkdnsrr() // Check if the email domain has a valid MX record return (bool) checkdnsrr(preg_replace('/^[^@]++@/', '', $email), 'MX'); }