Changeset 2356

Show
Ignore:
Timestamp:
03/26/2008 03:48:07 PM (8 months ago)
Author:
Shadowhand
Message:

Added valid::email_domain() to use checkdnsrr() to make sure that the email domain has a valid MX entry.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/helpers/valid.php

    r2263 r2356  
    2424 
    2525        /** 
     26         * Validate the domain of an email address by checking if the domain has a 
     27         * valid MX record. 
     28         * 
     29         * @param   string   email address 
     30         * @return  boolean 
     31         */ 
     32        public static function email_domain($email) 
     33        { 
     34                // Check if the email domain has a valid MX record 
     35                return (bool) checkdnsrr(preg_replace('/^.+@(.+)$/', '$1', $email), 'MX'); 
     36        } 
     37 
     38        /** 
    2639         * Validate email, RFC compliant version 
    2740         * Note: This function is LESS strict than valid_email. Choose carefully.