POP3::apop( $login,  $pass )

In this article

Source

function apop ($login,$pass) {
    //  Attempts an APOP login. If this fails, it'll
    //  try a standard login. YOUR SERVER MUST SUPPORT
    //  THE USE OF THE APOP COMMAND!
    //  (apop is optional per rfc1939)

    if(!isset($this->FP)) {
        $this->ERROR = "POP3 apop: " . _("No connection to server");
        return false;
    } elseif(!$this->ALLOWAPOP) {
        $retVal = $this->login($login,$pass);
        return $retVal;
    } elseif(empty($login)) {
        $this->ERROR = "POP3 apop: " . _("No login ID submitted");
        return false;
    } elseif(empty($pass)) {
        $this->ERROR = "POP3 apop: " . _("No password submitted");
        return false;
    } else {
        $banner = $this->BANNER;
        if( (!$banner) or (empty($banner)) ) {
            $this->ERROR = "POP3 apop: " . _("No server banner") . ' - ' . _("abort");
            $retVal = $this->login($login,$pass);
            return $retVal;
        } else {
            $AuthString = $banner;
            $AuthString .= $pass;
            $APOPString = md5($AuthString);
            $cmd = "APOP $login $APOPString";
            $reply = $this->send_cmd($cmd);
            if(!$this->is_ok($reply)) {
                $this->ERROR = "POP3 apop: " . _("apop authentication failed") . ' - ' . _("abort");
                $retVal = $this->login($login,$pass);
                return $retVal;
            } else {
                //  Auth successful.
                $count = $this->last("count");
                $this->COUNT = $count;
                return $count;
            }
        }
    }
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.