You are here

function SMTP::Expand in SMTP Authentication Support 5

Expand takes the name and asks the server to list all the people who are members of the _list_. Expand will return back and array of the result or false if an error occurs. Each value in the array returned has the format of: [ <full-name> <sp> ] <path> The definition of <path> is defined in rfc 821

Implements rfc 821: EXPN <SP> <string> <CRLF>

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

Return value

string array

File

./smtp.module, line 2378
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 Expand($name) {
  $this->error = null;

  # so no confusion is caused
  if (!$this
    ->connected()) {
    $this->error = array(
      "error" => "Called Expand() without being connected",
    );
    return false;
  }
  fputs($this->smtp_conn, "EXPN " . $name . $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" => "EXPN 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;
  }

  # parse the reply and place in our array to return to user
  $entries = explode($this->CRLF, $rply);
  while (list(, $l) = @each($entries)) {
    $list[] = substr($l, 4);
  }
  return $list;
}