POP3::send_cmd( $cmd = "" )

In this article

Source

function send_cmd ( $cmd = "" )
{
    //  Sends a user defined command string to the
    //  POP server and returns the results. Useful for
    //  non-compliant or custom POP servers.
    //  Do NOT include the \r\n as part of your command
    //  string - it will be appended automatically.

    //  The return value is a standard fgets() call, which
    //  will read up to $this->BUFFER bytes of data, until it
    //  encounters a new line, or EOF, whichever happens first.

    //  This method works best if $cmd responds with only
    //  one line of data.

    if(!isset($this->FP))
    {
        $this->ERROR = "POP3 send_cmd: " . _("No connection to server");
        return false;
    }

    if(empty($cmd))
    {
        $this->ERROR = "POP3 send_cmd: " . _("Empty command string");
        return "";
    }

    $fp = $this->FP;
    $buffer = $this->BUFFER;
    $this->update_timer();
    fwrite($fp,"$cmd\r\n");
    $reply = fgets($fp,$buffer);
    $reply = $this->strip_clf($reply);
    if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); }
    return $reply;
}

User Contributed Notes

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