You are here

function SMTP::Help in SMTP Authentication Support 5

Gets help information on the keyword specified. If the keyword is not specified then returns generic help, ussually contianing A list of keywords that help is available on. This function returns the results back to the user. It is up to the user to handle the returned data. If an error occurs then false is returned with $this->error set appropiately.

Implements rfc 821: HELP [ <SP> <string> ] <CRLF>

SMTP CODE SUCCESS: 211,214 SMTP CODE ERROR : 500,501,502,504,421 @access public

Return value

string

File

./smtp.module, line 2503
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 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;
}