PHPMailer\PHPMailer\POP3::authorise PHP Метод

authorise() публичный Метод

A connect, login, disconnect sequence appropriate for POP-before SMTP authorisation.
public authorise ( string $host, integer | boolean $port = false, integer | boolean $timeout = false, string $username = '', string $password = '', integer $debug_level ) : boolean
$host string The hostname to connect to
$port integer | boolean The port number to connect to
$timeout integer | boolean The timeout value
$username string
$password string
$debug_level integer
Результат boolean
    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 = $this->POP3_PORT;
        } else {
            $this->port = (int) $port;
        }
        // If no timeout value provided, use default
        if (false === $timeout) {
            $this->tval = $this->POP3_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;
    }