You are here

function SMTP::Reset in SMTP Authentication Support 5

Same name and namespace in other branches
  1. 7.2 smtp.transport.inc \SMTP::Reset()
  2. 7 smtp.transport.inc \SMTP::Reset()

Sends the RSET command to abort and transaction that is currently in progress. Returns true if successful false otherwise.

Implements rfc 821: RSET <CRLF>

SMTP CODE SUCCESS: 250 SMTP CODE ERROR : 500,501,504,421 @access public

Return value

bool

File

./smtp.module, line 2738
Enables drupal to send email directly to an SMTP server using authentication. Uses the PHPMailer class by Brent R. Matzelle.

Class

SMTP
SMTP is rfc 821 compliant and implements all the rfc 821 SMTP commands except TURN which will always return a not implemented error. SMTP also provides some utility methods for sending mail to an SMTP server. @package PHPMailer @author Chris Ryan

Code

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;
}