protected function addAnAddress($kind, $address, $name = '')
    {
        if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
            $this->setError($this->lang('Invalid recipient array') . ': ' . $kind);
            $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind);
            if ($this->exceptions) {
                throw new Mail\MailerException('Invalid recipient array: ' . $kind);
            }
            return false;
        }
        $address = trim($address);
        $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
        if (!$this->validateAddress($address)) {
            $this->setError($this->lang('invalid_address') . ': ' . $address);
            $this->edebug($this->lang('invalid_address') . ': ' . $address);
            if ($this->exceptions) {
                throw new Mail\MailerException($this->lang('invalid_address') . ': ' . $address);
            }
            return false;
        }
        if ($kind != 'Reply-To') {
            if (!isset($this->all_recipients[strtolower($address)])) {
                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 (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
            $this->setError($this->lang('Invalid recipient array') . ': ' . $kind);
            $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind);
            if ($this->exceptions) {
                throw new Mail\MailerException('Invalid recipient array: ' . $kind);
            }
            return false;
        }
        $address = trim($address);
        $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
        if (!$this->validateAddress($address)) {
            $this->setError($this->lang('invalid_address') . ': ' . $address);
            $this->edebug($this->lang('invalid_address') . ': ' . $address);
            if ($this->exceptions) {
                throw new Mail\MailerException($this->lang('invalid_address') . ': ' . $address);
            }
            return false;
        }
        if ($kind != 'Reply-To') {
            if (!isset($this->all_recipients[strtolower($address)])) {
                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 ( ! preg_match ( '/^(to|cc|bcc|Reply-To)$/' , $ kind ) ) { $ this -> setError ( $ this -> lang ( 'Invalid recipient array' ) . ': ' . $ kind ) ; $ this -> edebug ( $ this -> lang ( 'Invalid recipient array' ) . ': ' . $ kind ) ; if ( $ this -> exceptions ) { throw new Mail \ MailerException ( 'Invalid recipient array: ' . $ kind ) ; } return false ; } $ address = trim ( $ address ) ; $ name = trim ( preg_replace ( '/[\r\n]+/' , '' , $ name ) ) ; //Strip breaks and trim if ( ! $ this -> validateAddress ( $ address ) ) { $ this -> setError ( $ this -> lang ( 'invalid_address' ) . ': ' . $ address ) ; $ this -> edebug ( $ this -> lang ( 'invalid_address' ) . ': ' . $ address ) ; if ( $ this -> exceptions ) { throw new Mail \ MailerException ( $ this -> lang ( 'invalid_address' ) . ': ' . $ address ) ; } return false ; } if ( $ kind != 'Reply-To' ) { if ( ! isset ( $ this -> all_recipients [ strtolower ( $ address ) ] ) ) { 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.
Addresses that have been added already return false, but do not throw exceptions
@param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
@param string $address The email address to send 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 . Addresses that have been added already return false but do not throw exceptions