You are here

private function SMTP::SendHello in SMTP Authentication Support 7

Same name and namespace in other branches
  1. 5 smtp.module \SMTP::SendHello()
  2. 7.2 smtp.transport.inc \SMTP::SendHello()

Sends a HELO/EHLO command. @access private

Return value

bool

1 call to SMTP::SendHello()
SMTP::Hello in ./smtp.transport.inc
Sends the HELO command to the smtp server. This makes sure that we and the server are in the same known state.

File

./smtp.transport.inc, line 535
SMTP mail transport class for the smtp module,based on code of the phpmailer library, customized and relicensed to GPLv2

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. original author: Chris Ryan

Code

private function SendHello($hello, $host) {
  fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
  $rply = $this
    ->get_lines();
  $code = substr($rply, 0, 3);
  if ($this->do_debug >= 2) {
    drupal_set_message(t("SMTP -> FROM SERVER: @rply", array(
      "@rply" => $rply,
    )));
  }
  if ($code != 250) {
    $this->error = array(
      "error" => $hello . " not accepted from server",
      "smtp_code" => $code,
      "smtp_msg" => substr($rply, 4),
    );
    if ($this->do_debug >= 1) {
      drupal_set_message(t("SMTP -> ERROR: @error: @rply", array(
        "@error" => $this->error["error"],
        "@rply" => $rply,
      )));
    }
    return FALSE;
  }
  $this->helo_rply = $rply;
  return TRUE;
}