You are here

public function SMTP::Connected in SMTP Authentication Support 7.2

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

Returns TRUE if connected to a server otherwise FALSE @access public

Return value

bool

File

./smtp.transport.inc, line 275
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 Connected() {
  if (!empty($this->smtp_conn)) {
    $sock_status = socket_get_status($this->smtp_conn);
    if ($sock_status["eof"]) {

      // the socket is valid but we are not connected
      if ($this->do_debug >= 1) {
        drupal_set_message(t("SMTP -> NOTICE: EOF caught while checking if connected"));
      }
      $this
        ->Close();
      return FALSE;
    }
    return TRUE;

    // everything looks good
  }
  return FALSE;
}