SlightPHP\SMTP::Mail PHP Method

Mail() public method

Implements rfc 821: MAIL FROM: SMTP CODE SUCCESS: 250 SMTP CODE SUCCESS: 552,451,452 SMTP CODE SUCCESS: 500,501,421
public Mail ( $from ) : boolean
return boolean
    public function Mail($from)
    {
        $this->error = null;
        // so no confusion is caused
        if (!$this->connected()) {
            $this->error = array("error" => "Called Mail() without being connected");
            return false;
        }
        $useVerp = $this->do_verp ? "XVERP" : "";
        fputs($this->smtp_conn, "MAIL FROM:<" . $from . ">" . $useVerp . $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" => "MAIL 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 true;
    }