PHPMailer\PHPMailer
POP3::authorise
Authenticate with a POP3 server. A connect, login, disconnect sequence appropriate for POP-before SMTP authorisation.
Метод класса: POP3{}
Хуков нет.
Возвращает
bool.
Использование
$POP3 = new POP3(); $POP3->authorise( $host, $port, $timeout, $username, $password, $debug_level );
- $host(строка) (обязательный)
- The hostname to connect to.
- $port(int|true|false)
- The port number to connect to.
По умолчанию:false - $timeout(int|true|false)
- The timeout value.
По умолчанию:false - $username(строка)
- .
По умолчанию:'' - $password(строка)
- .
По умолчанию:'' - $debug_level(int)
- .
Код POP3::authorise() POP3::authorise WP 7.1.2
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 = (int) $debug_level;
$this->username = self::stripControls($username);
$this->password = self::stripControls($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;
}