You are here

function SMTP::Connected in SMTP Authentication Support 5

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

Returns true if connected to a server otherwise false @access private

Return value

bool

File

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

      # hmm this is an odd situation... the socket is

      # valid but we aren't connected anymore
      if ($this->do_debug >= 1) {
        echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
      }
      $this
        ->Close();
      return false;
    }
    return true;

    # everything looks good
  }
  return false;
}