You are here

public function SMTP::Hello in SMTP Authentication Support 7.2

Same name and namespace in other branches
  1. 5 smtp.module \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.transport.inc, line 468
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

public 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 hostname for HELO was not specified send default
  if (empty($host)) {

    // determine appropriate default to send to server
    $host = "localhost";
  }

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