protected function _validateAddrSpec($addr_spec)
    {
        $addr_spec = trim($addr_spec);

        // Split on @ sign if there is one.
        if (strpos($addr_spec, '@') !== false) {
            $parts      = explode('@', $addr_spec);
            $local_part = $this->_splitCheck($parts, '@');
            $domain     = substr($addr_spec, strlen($local_part . '@'));

        // No @ sign so assume the default domain.
        } else {
            $local_part = $addr_spec;
            $domain     = $this->default_domain;
        }

        if (($local_part = $this->_validateLocalPart($local_part)) === false) return false;
        if (($domain     = $this->_validateDomain($domain)) === false) return false;

        // Got here so return successful.
        return array('local_part' => $local_part, 'domain' => $domain);
    }
protected function _validateAddrSpec($addr_spec)
    {
        $addr_spec = trim($addr_spec);

        // Split on @ sign if there is one.
        if (strpos($addr_spec, '@') !== false) {
            $parts      = explode('@', $addr_spec);
            $local_part = $this->_splitCheck($parts, '@');
            $domain     = substr($addr_spec, strlen($local_part . '@'));

        // No @ sign so assume the default domain.
        } else {
            $local_part = $addr_spec;
            $domain     = $this->default_domain;
        }

        if (($local_part = $this->_validateLocalPart($local_part)) === false) return false;
        if (($domain     = $this->_validateDomain($domain)) === false) return false;

        // Got here so return successful.
        return array('local_part' => $local_part, 'domain' => $domain);
    }
protected function _validateAddrSpec ( $ addr_spec ) { $ addr_spec = trim ( $ addr_spec ) ; // Split on @ sign if there is one. if ( strpos ( $ addr_spec , '@' ) !== false ) { $ parts = explode ( '@' , $ addr_spec ) ; $ local_part = $ this -> _splitCheck ( $ parts , '@' ) ; $ domain = substr ( $ addr_spec , strlen ( $ local_part . '@' ) ) ; // No @ sign so assume the default domain. } else { $ local_part = $ addr_spec ; $ domain = $ this -> default_domain ; } if ( ( $ local_part = $ this -> _validateLocalPart ( $ local_part ) ) === false ) return false ; if ( ( $ domain = $ this -> _validateDomain ( $ domain ) ) === false ) return false ; // Got here so return successful. return array ( 'local_part' => $ local_part , 'domain' => $ domain ) ; }
Function to validate an addr-spec.

addr-spec = local-part "@" domain

@param string $addr_spec The string to check.
@return mixed False on failure, or the validated addr-spec on success.
Function to validate an addr - spec .