public function parseAddressList($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null)
    {
        if (!isset($this) || !isset($this->mailRFC822)) {
            $obj = new Mail_RFC822($address, $default_domain, $nest_groups, $validate, $limit);
            return $obj->parseAddressList();
        }

        if (isset($address))        $this->address        = $address;
        if (isset($default_domain)) $this->default_domain = $default_domain;
        if (isset($nest_groups))    $this->nestGroups     = $nest_groups;
        if (isset($validate))       $this->validate       = $validate;
        if (isset($limit))          $this->limit          = $limit;

        $this->structure  = array();
        $this->addresses  = array();
        $this->error      = null;
        $this->index      = null;

        // Unfold any long lines in $this->address.
        $this->address = preg_replace('/\r?\n/', "\r\n", $this->address);
        $this->address = preg_replace('/\r\n(\t| )+/', ' ', $this->address);

        while ($this->address = $this->_splitAddresses($this->address));

        if ($this->address === false || isset($this->error)) {
            require_once 'PEAR.php';
            return PEAR::raiseError($this->error);
        }

        // Validate each address individually.  If we encounter an invalid
        // address, stop iterating and return an error immediately.
        foreach ($this->addresses as $address) {
            $valid = $this->_validateAddress($address);

            if ($valid === false || isset($this->error)) {
                require_once 'PEAR.php';
                return PEAR::raiseError($this->error);
            }

            if (!$this->nestGroups) {
                $this->structure = array_merge($this->structure, $valid);
            } else {
                $this->structure[] = $valid;
            }
        }

        return $this->structure;
    }
public function parseAddressList($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null)
    {
        if (!isset($this) || !isset($this->mailRFC822)) {
            $obj = new Mail_RFC822($address, $default_domain, $nest_groups, $validate, $limit);
            return $obj->parseAddressList();
        }

        if (isset($address))        $this->address        = $address;
        if (isset($default_domain)) $this->default_domain = $default_domain;
        if (isset($nest_groups))    $this->nestGroups     = $nest_groups;
        if (isset($validate))       $this->validate       = $validate;
        if (isset($limit))          $this->limit          = $limit;

        $this->structure  = array();
        $this->addresses  = array();
        $this->error      = null;
        $this->index      = null;

        // Unfold any long lines in $this->address.
        $this->address = preg_replace('/\r?\n/', "\r\n", $this->address);
        $this->address = preg_replace('/\r\n(\t| )+/', ' ', $this->address);

        while ($this->address = $this->_splitAddresses($this->address));

        if ($this->address === false || isset($this->error)) {
            require_once 'PEAR.php';
            return PEAR::raiseError($this->error);
        }

        // Validate each address individually.  If we encounter an invalid
        // address, stop iterating and return an error immediately.
        foreach ($this->addresses as $address) {
            $valid = $this->_validateAddress($address);

            if ($valid === false || isset($this->error)) {
                require_once 'PEAR.php';
                return PEAR::raiseError($this->error);
            }

            if (!$this->nestGroups) {
                $this->structure = array_merge($this->structure, $valid);
            } else {
                $this->structure[] = $valid;
            }
        }

        return $this->structure;
    }
public function parseAddressList ( $ address = null , $ default_domain = null , $ nest_groups = null , $ validate = null , $ limit = null ) { if ( ! isset ( $ this ) || ! isset ( $ this -> mailRFC822 ) ) { $ obj = new Mail_RFC822 ( $ address , $ default_domain , $ nest_groups , $ validate , $ limit ) ; return $ obj -> parseAddressList ( ) ; } if ( isset ( $ address ) ) $ this -> address = $ address ; if ( isset ( $ default_domain ) ) $ this -> default_domain = $ default_domain ; if ( isset ( $ nest_groups ) ) $ this -> nestGroups = $ nest_groups ; if ( isset ( $ validate ) ) $ this -> validate = $ validate ; if ( isset ( $ limit ) ) $ this -> limit = $ limit ; $ this -> structure = array ( ) ; $ this -> addresses = array ( ) ; $ this -> error = null ; $ this -> index = null ; // Unfold any long lines in $this->address. $ this -> address = preg_replace ( '/\r?\n/' , "\r\n" , $ this -> address ) ; $ this -> address = preg_replace ( '/\r\n(\t| )+/' , ' ' , $ this -> address ) ; while ( $ this -> address = $ this -> _splitAddresses ( $ this -> address ) ) ; if ( $ this -> address === false || isset ( $ this -> error ) ) { require_once 'PEAR.php' ; return PEAR :: raiseError ( $ this -> error ) ; } // Validate each address individually.  If we encounter an invalid // address, stop iterating and return an error immediately. foreach ( $ this -> addresses as $ address ) { $ valid = $ this -> _validateAddress ( $ address ) ; if ( $ valid === false || isset ( $ this -> error ) ) { require_once 'PEAR.php' ; return PEAR :: raiseError ( $ this -> error ) ; } if ( ! $ this -> nestGroups ) { $ this -> structure = array_merge ( $ this -> structure , $ valid ) ; } else { $ this -> structure [ ] = $ valid ; } } return $ this -> structure ; }
Starts the whole process. The address must either be set here
or when creating the object. One or the other.

@param string  $address         The address(es) to validate.
@param string  $default_domain  Default domain/host etc.
@param boolean $nest_groups     Whether to return the structure with groups nested for easier viewing.
@param boolean $validate        Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance.

@return array A structured array of addresses.
Starts the whole process . The address must either be set here or when creating the object . One or the other .