public function POP3::login

5.x POP3.php public POP3::login($username = '', $password = '')

Log in to the POP3 server. Does not support APOP (RFC 2828, 4949).

Parameters

string $username:

string $password:

Return value

bool

1 call to POP3::login()
POP3::authorise in inc/PHPMailer/src/POP3.php
Authenticate with a POP3 server. A connect, login, disconnect sequence appropriate for POP-before SMTP authorisation.

File

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

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 login($username = '', $password = '') 
 {
  if (!$this->connected) {
    $this->setError('Not connected to POP3 server');
  }
  if (empty($username)) {
    $username = $this->username;
  }
  if (empty($password)) {
    $password = $this->password;
  }

  // Send the Username
  $this->sendString("USER $username" . static::LE);
  $pop3_response = $this->getResponse();
  if ($this->checkResponse($pop3_response)) {
    // Send the Password
    $this->sendString("PASS $password" . static::LE);
    $pop3_response = $this->getResponse();
    if ($this->checkResponse($pop3_response)) {
      return true;
    }
  }

  return false;
}