Home  >  Article  >  Backend Development  >  POP3 class written using PHP Socket (2)_PHP tutorial

POP3 class written using PHP Socket (2)_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:59:09923browse


//Log out
function popLogout()
{
if (!$this->getIsConnect() && $this->bolIsLogin)
{
return false;
}
$this->sendCommand("QUIT");
$this->getLineResponse();
if (!$this->getRestIsSucceed())
{
return false;
}
return true;
}

//Get whether online
function getIsOnline()
{
if (!$this->getIsConnect() && $this->bolIsLogin)
{
return false;
}
$this->sendCommand("NOOP");
$this->getLineResponse();
if (!$this->getRestIsSucceed())
{
return false;
}
return true;
}

//Get the number of emails and bytes (return array)
function getMailSum($intReturnType=2)
{
if (!$this->getIsConnect() && $this->bolIsLogin)
{
return false;
}
$this->sendCommand("STAT");
$strLineResponse = $this->getLineResponse();
if (!$this->getRestIsSucceed())
{
return false;
}
if ($intReturnType==1)
{
return $this->strResponse;
}
else
{
$arrResponse = explode(" ", $this->strResponse);
if (!is_array($arrResponse) || count($arrResponse)<=0)
{
$this->setMessage('STAT command response message is error', 2006);
return false;
}
return array($arrResponse[1], $arrResponse[2]);
}
}

//Get the Session Id of the specified email
function getMailSessId($intMailId, $intReturnType=2)
{
if (!$this->getIsConnect() && $this->bolIsLogin)
{
return false;
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631952.htmlTechArticle//Logout function popLogout() { if (!$this-getIsConnect() $this-bolIsLogin) { return false; } $this-sendCommand(QUIT); $this-getLineResponse(); if (!$this-getRestIsSucceed())...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn