phpmailer-php5/class.phpmailer.php
protected function addAnAddress($kind, $address, $name = '')
    {
        if (!in_array($kind, array('to', 'cc', 'bcc', 'Reply-To'))) {
            $error_message = $this->lang('Invalid recipient kind: ') . $kind;
            $this->setError($error_message);
            $this->edebug($error_message);
            if ($this->exceptions) {
                throw new phpmailerException($error_message);
            }
            return false;
        }
        if (!$this->validateAddress($address)) {
            $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
            $this->setError($error_message);
            $this->edebug($error_message);
            if ($this->exceptions) {
                throw new phpmailerException($error_message);
            }
            return false;
        }
        if ($kind != 'Reply-To') {
            if (!array_key_exists(strtolower($address), $this->all_recipients)) {
                array_push($this->$kind, array($address, $name));
                $this->all_recipients[strtolower($address)] = true;
                return true;
            }
        } else {
            if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
                $this->ReplyTo[strtolower($address)] = array($address, $name);
                return true;
            }
        }
        return false;
    }
protected function addAnAddress($kind, $address, $name = '')
    {
        if (!in_array($kind, array('to', 'cc', 'bcc', 'Reply-To'))) {
            $error_message = $this->lang('Invalid recipient kind: ') . $kind;
            $this->setError($error_message);
            $this->edebug($error_message);
            if ($this->exceptions) {
                throw new phpmailerException($error_message);
            }
            return false;
        }
        if (!$this->validateAddress($address)) {
            $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
            $this->setError($error_message);
            $this->edebug($error_message);
            if ($this->exceptions) {
                throw new phpmailerException($error_message);
            }
            return false;
        }
        if ($kind != 'Reply-To') {
            if (!array_key_exists(strtolower($address), $this->all_recipients)) {
                array_push($this->$kind, array($address, $name));
                $this->all_recipients[strtolower($address)] = true;
                return true;
            }
        } else {
            if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
                $this->ReplyTo[strtolower($address)] = array($address, $name);
                return true;
            }
        }
        return false;
    }
protected function addAnAddress ( $ kind , $ address , $ name = '' ) { if ( ! in_array ( $ kind , array ( 'to' , 'cc' , 'bcc' , 'Reply-To' ) ) ) { $ error_message = $ this -> lang ( 'Invalid recipient kind: ' ) . $ kind ; $ this -> setError ( $ error_message ) ; $ this -> edebug ( $ error_message ) ; if ( $ this -> exceptions ) { throw new phpmailerException ( $ error_message ) ; } return false ; } if ( ! $ this -> validateAddress ( $ address ) ) { $ error_message = $ this -> lang ( 'invalid_address' ) . " (addAnAddress $kind): $address" ; $ this -> setError ( $ error_message ) ; $ this -> edebug ( $ error_message ) ; if ( $ this -> exceptions ) { throw new phpmailerException ( $ error_message ) ; } return false ; } if ( $ kind != 'Reply-To' ) { if ( ! array_key_exists ( strtolower ( $ address ) , $ this -> all_recipients ) ) { array_push ( $ this -> $ kind , array ( $ address , $ name ) ) ; $ this -> all_recipients [ strtolower ( $ address ) ] = true ; return true ; } } else { if ( ! array_key_exists ( strtolower ( $ address ) , $ this -> ReplyTo ) ) { $ this -> ReplyTo [ strtolower ( $ address ) ] = array ( $ address , $ name ) ; return true ; } } return false ; }
Add an address to one of the recipient arrays or to the ReplyTo array.
Addresses that have been added already return false, but do not throw exceptions.
@param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
@param string $address The email address to send, resp. to reply to
@param string $name
@throws phpmailerException
@return boolean true on success, false if address already used or invalid in some way
@access protected
Add an address to one of the recipient arrays or to the ReplyTo array . Addresses that have been added already return false but do not throw exceptions .