fgets($this->Socket, 1024), 0, 1) <> ".")
{
$data[$i] = $this->Line;
$i++;
}
$data[ "count"] = $i;
return $data;
}
function pop3_dele( $nr)
{
fputs($this->Socket, "DELE $nrrn");
$this->Line = fgets($this->Socket, 1024);
$this->Status[ "LASTRESULT"] = substr($this->Line, 0, 1);
$this->Status[ "LASTRESULTTXT"] = substr($this->Line, 0, 1024);
if ($this->Status[ "LASTRESULT"] <> "+") return 0;
return 1;
}
function pop3_quit()
{
fputs($this->Socket, "QUITrn");
$this->Line = fgets($this->Socket, 1024);
$this->Status[ "LASTRESULT"] = substr($this->Line, 0, 1);
$this->Status[ "LASTRESULTTXT"] = substr($this->Line, 0, 1024);
if ($this->Status[ "LASTRESULT"] <> "+") return 0;
return 1;
}
}
class Smtp {
var $Subject; // string the email''s subject
var $FromName; // string sender''s name (opt)
var $ToName; // string recipient''s name (opt)
var $Body; // string body copy
var $Attachment; // attachment (optional)
var $AttachmentType;
var $Socket;
var $Line;
var $Status;
function Smtp($Server = "localhost",$Port = SmtpPort)
{
return $this->Open($Server, $Port);
}
function SmtpMail($FromEmail, $FromName, $ToEmail, $ToName, $Subject, $Body, $Attachment=null, $AttachmentType= "TEXT")
{
$this->Subject = $Subject;
$this->ToName = $ToName;
$this->FromName = $FromName;
$this->Body = $Body;
$this->Attachment = $Attachment;
$this->AttachmentType = $AttachmentType;
if ($this->Helo() == false){
return false;
}
if ($this->MailFrom($FromEmail) == false){
return false;
}
if ($this->RcptTo($ToEmail) == false){
return false;
}
if ($this->Body() == false){
return false;
}
if ($this->Quit() == false){
return false;
}
}
function Open($Server, $Port)
{
$this->Socket = fsockopen($Server, $Port);
if ($this->Socket < 0) return false;
$this->Line = fgets($this->Socket, 1024);
$this->Status[ "LASTRESULT"] = substr($this->Line, 0, 1);
$this->Status[ "LASTRESULTTXT"] = substr($this->Line, 0, 1024);
if ($this->Status[ "LASTRESULT"] <> "2") return false;
return true;
}
function Helo()
{
if (fputs($this->Socket, "helorn") < 0 ){
return false;
}
$this->Line = fgets($this->Socket, 1024);
$this->Status[ "LASTRESULT"] = substr($this->Line, 0, 1);
$this->Status[ "LASTRESULTTXT"] = substr($this->Line, 0, 1024);
if ($this->Status[ "LASTRESULT"] <> "2") return false;
return true;
}
function Ehlo()
{
/* Well, let''s use "helo" for now.. Until we need the
extra func''s [Unk]
*/
if(fputs($this->Socket, "helo localhostrn")<0){
return false;
}
$this->Line = fgets($this->Socket, 1024);
$this->Status[ "LASTRESULT"] = substr($this->Line, 0, 1);
$this->Statu