SlightPHP\SMTP::Reset PHP Method

Reset() public method

Implements rfc 821: RSET SMTP CODE SUCCESS: 250 SMTP CODE ERROR : 500,501,504,421
public Reset ( ) : boolean
return boolean
    public function Reset()
    {
        $this->error = null;
        // so no confusion is caused
        if (!$this->connected()) {
            $this->error = array("error" => "Called Reset() without being connected");
            return false;
        }
        fputs($this->smtp_conn, "RSET" . $this->CRLF);
        $rply = $this->get_lines();
        $code = substr($rply, 0, 3);
        if ($this->do_debug >= 2) {
            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
        }
        if ($code != 250) {
            $this->error = array("error" => "RSET failed", "smtp_code" => $code, "smtp_msg" => substr($rply, 4));
            if ($this->do_debug >= 1) {
                echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
            }
            return false;
        }
        return true;
    }