SlightPHP\SMTP::Help PHP Method

Help() public method

Implements rfc 821: HELP [ ] SMTP CODE SUCCESS: 211,214 SMTP CODE ERROR : 500,501,502,504,421
public Help ( $keyword = "" ) : string
return string
    public function Help($keyword = "")
    {
        $this->error = null;
        // to avoid confusion
        if (!$this->connected()) {
            $this->error = array("error" => "Called Help() without being connected");
            return false;
        }
        $extra = "";
        if (!empty($keyword)) {
            $extra = " " . $keyword;
        }
        fputs($this->smtp_conn, "HELP" . $extra . $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 != 211 && $code != 214) {
            $this->error = array("error" => "HELP not accepted from server", "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 $rply;
    }