src/Comely/IO/Mailer/Agents/SMTP.php
public function command(string $command, string $args = null, int $expect = 0): string
    {
        $sendCommand = $args ? sprintf('%1$s %2$s', $command, $args) : $command;
        $this->write($sendCommand);
        $response = $this->read();
        $responseCode = $this->lastResponseCode();

        if ($expect > 0) {
            if ($responseCode !== $expect) {
                throw SMTPException::unexpectedResponse($command, $expect, $responseCode);
            }
        }

        return $response;
    }
public function command(string $command, string $args = null, int $expect = 0): string
    {
        $sendCommand = $args ? sprintf('%1$s %2$s', $command, $args) : $command;
        $this->write($sendCommand);
        $response = $this->read();
        $responseCode = $this->lastResponseCode();

        if ($expect > 0) {
            if ($responseCode !== $expect) {
                throw SMTPException::unexpectedResponse($command, $expect, $responseCode);
            }
        }

        return $response;
    }
public function command ( string $ command , string $ args = null , int $ expect = 0 ) : string { $ sendCommand = $ args ? sprintf ( '%1$s %2$s' , $ command , $ args ) : $ command ; $ this -> write ( $ sendCommand ) ; $ response = $ this -> read ( ) ; $ responseCode = $ this -> lastResponseCode ( ) ; if ( $ expect > 0 ) { if ( $ responseCode !== $ expect ) { throw SMTPException :: unexpectedResponse ( $ command , $ expect , $ responseCode ) ; } } return $ response ; }
Send command to server, read response, and make sure response code matches expected code

@param string $command
@param string|null $args
@param int $expect
@return string
@throws SMTPException
Send command to server read response and make sure response code matches expected code