public function top($msgno, $lines = 0, $fallback = false)
    {
        if ($this->hasTop === false) {
            if ($fallback) {
                return $this->retrieve($msgno);
            } else {
                /**
                 * @see Zend_Mail_Protocol_Exception
                 */
                // require_once 'Zend/Mail/Protocol/Exception.php';
                throw new Zend_Mail_Protocol_Exception('top not supported and no fallback wanted');
            }
        }
        $this->hasTop = true;

        $lines = (!$lines || $lines < 1) ? 0 : (int)$lines;

        try {
            $result = $this->request("TOP $msgno $lines", true);
        } catch (Zend_Mail_Protocol_Exception $e) {
            $this->hasTop = false;
            if ($fallback) {
                $result = $this->retrieve($msgno);
            } else {
                throw $e;
            }
        }

        return $result;
    }
public function top($msgno, $lines = 0, $fallback = false)
    {
        if ($this->hasTop === false) {
            if ($fallback) {
                return $this->retrieve($msgno);
            } else {
                /**
                 * @see Zend_Mail_Protocol_Exception
                 */
                // require_once 'Zend/Mail/Protocol/Exception.php';
                throw new Zend_Mail_Protocol_Exception('top not supported and no fallback wanted');
            }
        }
        $this->hasTop = true;

        $lines = (!$lines || $lines < 1) ? 0 : (int)$lines;

        try {
            $result = $this->request("TOP $msgno $lines", true);
        } catch (Zend_Mail_Protocol_Exception $e) {
            $this->hasTop = false;
            if ($fallback) {
                $result = $this->retrieve($msgno);
            } else {
                throw $e;
            }
        }

        return $result;
    }
public function top ( $ msgno , $ lines = 0 , $ fallback = false ) { if ( $ this -> hasTop === false ) { if ( $ fallback ) { return $ this -> retrieve ( $ msgno ) ; } else { /**
                 * @see Zend_Mail_Protocol_Exception
                 */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception ( 'top not supported and no fallback wanted' ) ; } } $ this -> hasTop = true ; $ lines = ( ! $ lines || $ lines < 1 ) ? 0 : ( int ) $ lines ; try { $ result = $ this -> request ( "TOP $msgno $lines" , true ) ; } catch ( Zend_Mail_Protocol_Exception $ e ) { $ this -> hasTop = false ; if ( $ fallback ) { $ result = $ this -> retrieve ( $ msgno ) ; } else { throw $ e ; } } return $ result ; }
Make TOP call for getting headers and maybe some body lines
This method also sets hasTop - before it it's not known if top is supported

The fallback makes normale RETR call, which retrieves the whole message. Additional
lines are not removed.

@param  int  $msgno    number of message
@param  int  $lines    number of wanted body lines (empty line is inserted after header lines)
@param  bool $fallback fallback with full retrieve if top is not supported
@return string message headers with wanted body lines
@throws Zend_Mail_Protocol_Exception
Make TOP call for getting headers and maybe some body lines This method also sets hasTop - before it it s not known if top is supported