You are here

function SMTP::Hello in SMTP Authentication Support 5

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

Sends the HELO command to the smtp server. This makes sure that we and the server are in the same known state.

Implements from rfc 821: HELO <SP> <domain> <CRLF>

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

Return value

bool

File

./smtp.module, line 2429
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 Hello($host = "") {
  $this->error = null;

  # so no confusion is caused
  if (!$this
    ->connected()) {
    $this->error = array(
      "error" => "Called Hello() without being connected",
    );
    return false;
  }

  # if a hostname for the HELO wasn't specified determine

  # a suitable one to send
  if (empty($host)) {

    # we need to determine some sort of appopiate default

    # to send to the server
    $host = "localhost";
  }

  // Send extended hello first (RFC 2821)
  if (!$this
    ->SendHello("EHLO", $host)) {
    if (!$this
      ->SendHello("HELO", $host)) {
      return false;
    }
  }
  return true;
}