p; if(GetType($response)!="string")
return("Could not get APOP login command response");
if(strtok($response," ")!="+OK")
return("APOP login failed: ".strtok(" "));
}
else
{
if($this->PutLine("USER $user")==0)
return("Could not send the USER command");
$response=$this->GetLine();
if(GetType($response)!="string")
return("Could not get user login entry response");
if(strtok($response," ")!="+OK")
return("User error: ".strtok(" "));
if($this->PutLine("PASS $password")==0)
return("Could not send the PASS command");
$response=$this->GetLine();
if(GetType($response)!="string")
return("Could not get login password entry response");
if(strtok($response," ")!="+OK")
return("Password error: ".strtok(" "));
}
$this->state="TRANSACTION";
return("");
}
/* Statistics method - pass references to variables to hold the number of
messages in the mail box and the size that they take in bytes. */
Function Statistics($messages,$size)
{
if($this->state!="TRANSACTION")
return("connection is not in TRANSACTION state");
if($this->PutLine("STAT")==0)
return("Could not send the STAT command");
$response=$this->GetLine();
if(GetType($response)!="string")
return("Could not get the statistics command response");
if(strtok($response," ")!="+OK")
return("Could not get the statistics: ".strtok(" "));
$messages=strtok(" ");
$size=strtok(" ");
return("");
}
Function ListMessages($message,$unique_id)
{
if($this->state!="TRANSACTION")
return("connection is not in TRANSACTION state");
if($unique_id)
$list_command="UIDL";
else
$list_command="LIST";
if($this->PutLine("$list_command $message")==0)
return("Could not send the $list_command command");
$response=$this->GetLine();
if(GetType($response)!="string")
return("Could not get message list command response");
if(strtok($response," ")!="+OK")
return("Could not get the message listing: ".strtok(" "));
if($message=="")
{
for($messages=array();;)
{
&
return("Could not get APOP login command response");
if(strtok($response," ")!="+OK")
return("APOP login failed: ".strtok(" "));
}
else
{
if($this->PutLine("USER $user")==0)
return("Could not send the USER command");
$response=$this->GetLine();
if(GetType($response)!="string")
return("Could not get user login entry response");
if(strtok($response," ")!="+OK")
return("User error: ".strtok(" "));
if($this->PutLine("PASS $password")==0)
return("Could not send the PASS command");
$response=$this->GetLine();
if(GetType($response)!="string")
return("Could not get login password entry response");
if(strtok($response," ")!="+OK")
return("Password error: ".strtok(" "));
}
$this->state="TRANSACTION";
return("");
}
/* Statistics method - pass references to variables to hold the number of
messages in the mail box and the size that they take in bytes. */
Function Statistics($messages,$size)
{
if($this->state!="TRANSACTION")
return("connection is not in TRANSACTION state");
if($this->PutLine("STAT")==0)
return("Could not send the STAT command");
$response=$this->GetLine();
if(GetType($response)!="string")
return("Could not get the statistics command response");
if(strtok($response," ")!="+OK")
return("Could not get the statistics: ".strtok(" "));
$messages=strtok(" ");
$size=strtok(" ");
return("");
}
Function ListMessages($message,$unique_id)
{
if($this->state!="TRANSACTION")
return("connection is not in TRANSACTION state");
if($unique_id)
$list_command="UIDL";
else
$list_command="LIST";
if($this->PutLine("$list_command $message")==0)
return("Could not send the $list_command command");
$response=$this->GetLine();
if(GetType($response)!="string")
return("Could not get message list command response");
if(strtok($response," ")!="+OK")
return("Could not get the message listing: ".strtok(" "));
if($message=="")
{
for($messages=array();;)
{
&