this->error="";
if(!$this->PutLine("RSET")
|| $this->VerifyResultLines("250")<=0)
return(0);
$this->state="Connected";
return(1);
}
Function Disconnect($quit=1)
{
if(!strcmp($this->state,"Disconnected"))
{
$this->error="it was not previously established a SMTP connection";
return(0);
}
$this->error="";
if(!strcmp($this->state,"Connected")
&& $quit
&& (!$this->PutLine("QUIT")
|| $this->VerifyResultLines("221")<=0))
return(0);
fclose($this->connection);
$this->connection=0;
$this->state="Disconnected";
return(1);
}
Function SendMessage($sender,$recipients,$headers,$body)
{
if(($success=$this->Connect()))
{
if(($success=$this->MailFrom($sender)))
{
for($recipient=0;$recipient {
if(!($success=$this->SetRecipient($recipients[$recipient])))
break;
}
if($success
&& ($success=$this->StartData()))
{
for($header_data="",$header=0;$header $header_data.=$headers[$header]."rn";
if(($success=$this->SendData($header_data."rn")))
{
$this->PrepareData($body,&$body_data);
$success=$this->SendData($body_data);
}
if($success)
$success=$this->EndSendingData();
}
}
$disconnect_success=$this->Disconnect($success);
if($success)
$success=$disconnect_success;
}
return($success);
}
};
?>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
if(!$this->PutLine("RSET")
|| $this->VerifyResultLines("250")<=0)
return(0);
$this->state="Connected";
return(1);
}
Function Disconnect($quit=1)
{
if(!strcmp($this->state,"Disconnected"))
{
$this->error="it was not previously established a SMTP connection";
return(0);
}
$this->error="";
if(!strcmp($this->state,"Connected")
&& $quit
&& (!$this->PutLine("QUIT")
|| $this->VerifyResultLines("221")<=0))
return(0);
fclose($this->connection);
$this->connection=0;
$this->state="Disconnected";
return(1);
}
Function SendMessage($sender,$recipients,$headers,$body)
{
if(($success=$this->Connect()))
{
if(($success=$this->MailFrom($sender)))
{
for($recipient=0;$recipient {
if(!($success=$this->SetRecipient($recipients[$recipient])))
break;
}
if($success
&& ($success=$this->StartData()))
{
for($header_data="",$header=0;$header $header_data.=$headers[$header]."rn";
if(($success=$this->SendData($header_data."rn")))
{
$this->PrepareData($body,&$body_data);
$success=$this->SendData($body_data);
}
if($success)
$success=$this->EndSendingData();
}
}
$disconnect_success=$this->Disconnect($success);
if($success)
$success=$disconnect_success;
}
return($success);
}
};
?>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】