Nette\Mail\SmtpMailer::write PHP Method

write() protected method

Writes data to server and checks response against expected code if some provided.
protected write ( $line, $expectedCode = NULL, $message = NULL ) : void
return void
    protected function write($line, $expectedCode = NULL, $message = NULL)
    {
        fwrite($this->connection, $line . Message::EOL);
        if ($expectedCode) {
            $response = $this->read();
            if (!in_array((int) $response, (array) $expectedCode, TRUE)) {
                throw new SmtpException('SMTP server did not accept ' . ($message ? $message : $line) . ' with error: ' . trim($response));
            }
        }
    }