public function POP3::authorise

5.x POP3.php public POP3::authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)

Authenticate with a POP3 server. A connect, login, disconnect sequence appropriate for POP-before SMTP authorisation.

Parameters

string $host The hostname to connect to:

int|bool $port The port number to connect to:

int|bool $timeout The timeout value:

string $username:

string $password:

int $debug_level:

Return value

bool

File

inc/PHPMailer/src/POP3.php, line 172

Class

POP3
PHPMailer POP-Before-SMTP Authentication Class. Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication. 1) This class does not support APOP authentication. 2) Opening and closing lots of POP3 connections can be quite slow. If you…

Namespace

PHPMailer\PHPMailer

Code

public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0) 
 {
  $this->host = $host;
  // If no port value provided, use default
  if (false === $port) {
    $this->port = static::DEFAULT_PORT;
  }
  else {
    $this->port = (int) $port;
  }
  // If no timeout value provided, use default
  if (false === $timeout) {
    $this->tval = static::DEFAULT_TIMEOUT;
  }
  else {
    $this->tval = (int) $timeout;
  }
  $this->do_debug = $debug_level;
  $this->username = $username;
  $this->password = $password;
  //  Reset the error log
  $this->errors = [];
  //  connect
  $result = $this->connect($this->host, $this->port, $this->tval);
  if ($result) {
    $login_result = $this->login($this->username, $this->password);
    if ($login_result) {
      $this->disconnect();

      return true;
    }
  }
  // We need to disconnect regardless of whether the login succeeded
  $this->disconnect();

  return false;
}