includes/pop3/pop3.php
/* RetrieveMessage method - the $message argument indicates the number of
     a message to be listed.  Pass a reference variables that will hold the
     arrays of the $header and $body lines.  The $lines argument tells how
     many lines of the message are to be retrieved.  Pass a negative number
     if you want to retrieve the whole message. */
RetrieveMessage method - the $message argument indicates the number of
a message to be listed.  Pass a reference variables that will hold the
arrays of the $header and $body lines.  The $lines argument tells how
many lines of the message are to be retrieved.  Pass a negative number
if you want to retrieve the whole message.
RetrieveMessage method - the $message argument indicates the number of a message to be listed . Pass a reference variables that will hold the arrays of the $header and $body lines . The $lines argument tells how many lines of the message are to be retrieved . Pass a negative number if you want to retrieve the whole message .
Function RetrieveMessage($message,&$headers,&$body,$lines)
	{
		if($this->state!="TRANSACTION")
			return($this->SetError("connection is not in TRANSACTION state"));
		if($lines<0)
		{
			$command="RETR";
			$arguments="$message";
		}
		else
		{
			$command="TOP";
			$arguments="$message $lines";
		}
		if($this->PutLine("$command $arguments")==0)
			return($this->SetError("Could not send the $command command"));
		$response=$this->GetLine();
		if(GetType($response)!="string")
			return($this->SetError("Could not get message retrieval command response"));
		if($this->Tokenize($response," ")!="+OK")
			return($this->SetError("Could not retrieve the message: ".$this->Tokenize("\r\n")));
		for($headers=$body=array(),$line=0;;)
		{
			$response=$this->GetLine();
			if(GetType($response)!="string")
				return($this->SetError("Could not retrieve the message"));
			switch($response)
			{
				case ".":
					return("");
				case "":
					break 2;
				default:
					if(substr($response,0,1)==".")
						$response=substr($response,1,strlen($response)-1);
					break;
			}
			if($this->join_continuation_header_lines
			&& $line>0
			&& ($response[0]=="\t"
			|| $response[0]==" "))
				$headers[$line-1].=$response;
			else
			{
				$headers[$line]=$response;
				$line++;
			}
		}
		for($line=0;;$line++)
		{
			$response=$this->GetLine();
			if(GetType($response)!="string")
				return($this->SetError("Could not retrieve the message"));
			switch($response)
			{
				case ".":
					return("");
				default:
					if(substr($response,0,1)==".")
						$response=substr($response,1,strlen($response)-1);
					break;
			}
			$body[$line]=$response;
		}
		return("");
	}
Function RetrieveMessage ( $ message , & $ headers , & $ body , $ lines ) { if ( $ this -> state != " TRANSACTION " ) return ( $ this -> SetError ( " connection is not in TRANSACTION state " ) ) ; if ( $ lines < 0 ) { $ command = " RETR " ; $ arguments = " $ message " ; } else { $ command = " TOP " ; $ arguments = " $ message $ lines " ; } if ( $ this -> PutLine ( " $ command $ arguments " ) == 0 ) return ( $ this -> SetError ( " Could not send the  $ command  command " ) ) ; $ response = $ this -> GetLine ( ) ; if ( GetType ( $ response ) != " string " ) return ( $ this -> SetError ( " Could not get message retrieval command response " ) ) ; if ( $ this -> Tokenize ( $ response , " " ) != " +OK " ) return ( $ this -> SetError ( " Could not retrieve the message:  " . $ this -> Tokenize ( " \r \n " ) ) ) ; for ( $ headers = $ body = array ( ) , $ line = 0 ; ; ) { $ response = $ this -> GetLine ( ) ; if ( GetType ( $ response ) != " string " ) return ( $ this -> SetError ( " Could not retrieve the message " ) ) ; switch ( $ response ) { case " . " : return ( " " ) ; case " " : break 2 ; default : if ( substr ( $ response , 0 , 1 ) == " . " ) $ response = substr ( $ response , 1 , strlen ( $ response ) - 1 ) ; break ; } if ( $ this -> join_continuation_header_lines && $ line > 0 && ( $ response [ 0 ] == " \t " || $ response [ 0 ] == " " ) ) $ headers [ $ line - 1 ] .= $ response ; else { $ headers [ $ line ] = $ response ; $ line ++ ; } } for ( $ line = 0 ; ; $ line ++ ) { $ response = $ this -> GetLine ( ) ; if ( GetType ( $ response ) != " string " ) return ( $ this -> SetError ( " Could not retrieve the message " ) ) ; switch ( $ response ) { case " . " : return ( " " ) ; default : if ( substr ( $ response , 0 , 1 ) == " . " ) $ response = substr ( $ response , 1 , strlen ( $ response ) - 1 ) ; break ; } $ body [ $ line ] = $ response ; } return ( " " ) ; }
RetrieveMessage method - the $message argument indicates the number of
a message to be listed.
RetrieveMessage method - the $message argument indicates the number of a message to be listed .