public function getHeader($name, $format = null)
    {
        if ($this->_headers === null) {
            $this->getHeaders();
        }

        $lowerName = strtolower($name);

        if ($this->headerExists($name) == false) {
            $lowerName = strtolower(preg_replace('%([a-z])([A-Z])%', '\1-\2', $name));
            if($this->headerExists($lowerName) == false) {
                /**
                 * @see Zend_Mail_Exception
                 */
                // require_once 'Zend/Mail/Exception.php';
                throw new Zend_Mail_Exception("no Header with Name $name or $lowerName found");
            }
        }
        $name = $lowerName;

        $header = $this->_headers[$name];

        switch ($format) {
            case 'string':
                if (is_array($header)) {
                    $header = implode(Zend_Mime::LINEEND, $header);
                }
                break;
            case 'array':
                $header = (array)$header;
            default:
                // do nothing
        }

        return $header;
    }
public function getHeader($name, $format = null)
    {
        if ($this->_headers === null) {
            $this->getHeaders();
        }

        $lowerName = strtolower($name);

        if ($this->headerExists($name) == false) {
            $lowerName = strtolower(preg_replace('%([a-z])([A-Z])%', '\1-\2', $name));
            if($this->headerExists($lowerName) == false) {
                /**
                 * @see Zend_Mail_Exception
                 */
                // require_once 'Zend/Mail/Exception.php';
                throw new Zend_Mail_Exception("no Header with Name $name or $lowerName found");
            }
        }
        $name = $lowerName;

        $header = $this->_headers[$name];

        switch ($format) {
            case 'string':
                if (is_array($header)) {
                    $header = implode(Zend_Mime::LINEEND, $header);
                }
                break;
            case 'array':
                $header = (array)$header;
            default:
                // do nothing
        }

        return $header;
    }
public function getHeader ( $ name , $ format = null ) { if ( $ this -> _headers === null ) { $ this -> getHeaders ( ) ; } $ lowerName = strtolower ( $ name ) ; if ( $ this -> headerExists ( $ name ) == false ) { $ lowerName = strtolower ( preg_replace ( '%([a-z])([A-Z])%' , '\1-\2' , $ name ) ) ; if ( $ this -> headerExists ( $ lowerName ) == false ) { /**
                 * @see Zend_Mail_Exception
                 */ // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception ( "no Header with Name $name or $lowerName found" ) ; } } $ name = $ lowerName ; $ header = $ this -> _headers [ $ name ] ; switch ( $ format ) { case 'string' : if ( is_array ( $ header ) ) { $ header = implode ( Zend_Mime :: LINEEND , $ header ) ; } break ; case 'array' : $ header = ( array ) $ header ; default : // do nothing } return $ header ; }
Get a header in specificed format

Internally headers that occur more than once are saved as array, all other as string. If $format
is set to string implode is used to concat the values (with Zend_Mime::LINEEND as delim).

@param  string $name   name of header, matches case-insensitive, but camel-case is replaced with dashes
@param  string $format change type of return value to 'string' or 'array'
@return string|array value of header in wanted or internal format
@throws Zend_Mail_Exception
Get a header in specificed format