Documentation

POP3
in package

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 need to send a batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine.
  3. This is really ancient technology; you should only need to use it to talk to very old systems.
  4. This POP3 class is deliberately lightweight and incomplete, and implements just enough to do authentication. If you want a more complete class there are other POP3 classes for PHP available.
Tags
author

Richard Davey (original author) rich@corephp.co.uk

author

Marcus Bointon (Synchro/coolbru) phpmailer@synchromedia.co.uk

author

Jim Jagielski (jimjag) jimjag@gmail.com

author

Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net

Table of Contents

DEFAULT_PORT  = 110
Default POP3 port number.
DEFAULT_TIMEOUT  = 30
Default timeout in seconds.
LE  = " "
Line break constant.
VERSION  = '6.0.1'
The POP3 PHPMailer Version number.
$do_debug  : int
Debug display level.
$host  : string
POP3 mail server hostname.
$password  : string
POP3 password.
$port  : int
POP3 port number.
$tval  : int
POP3 Timeout Value in seconds.
$username  : string
POP3 username.
$connected  : bool
Are we connected?
$errors  : array<string|int, mixed>
Error container.
$pop_conn  : resource
Resource handle for the POP3 connection socket.
authorise()  : bool
Authenticate with a POP3 server.
connect()  : bool
Connect to a POP3 server.
disconnect()  : mixed
Disconnect from the POP3 server.
getErrors()  : array<string|int, mixed>
Get an array of error messages, if any.
login()  : bool
Log in to the POP3 server.
popBeforeSmtp()  : bool
Simple static wrapper for all-in-one POP before SMTP.
catchWarning()  : mixed
POP3 connection error handler.
checkResponse()  : bool
Checks the POP3 server response.
getResponse()  : string
Get a response from the POP3 server.
sendString()  : int
Send raw data to the POP3 server.
setError()  : mixed
Add an error to the internal error store.

Constants

DEFAULT_PORT

Default POP3 port number.

public int DEFAULT_PORT = 110

DEFAULT_TIMEOUT

Default timeout in seconds.

public int DEFAULT_TIMEOUT = 30

LE

Line break constant.

public mixed LE = " "

VERSION

The POP3 PHPMailer Version number.

public string VERSION = '6.0.1'

Properties

$do_debug

Debug display level.

public int $do_debug = 0

Options: 0 = no, 1+ = yes.

$host

POP3 mail server hostname.

public string $host

$password

POP3 password.

public string $password

$port

POP3 port number.

public int $port

$tval

POP3 Timeout Value in seconds.

public int $tval

$username

POP3 username.

public string $username

$connected

Are we connected?

protected bool $connected = false

$errors

Error container.

protected array<string|int, mixed> $errors = []

$pop_conn

Resource handle for the POP3 connection socket.

protected resource $pop_conn

Methods

authorise()

Authenticate with a POP3 server.

public authorise(string $host[, int|bool $port = false ][, int|bool $timeout = false ][, string $username = '' ][, string $password = '' ], int $debug_level) : bool

A connect, login, disconnect sequence appropriate for POP-before SMTP authorisation.

Parameters
$host : string

The hostname to connect to

$port : int|bool = false

The port number to connect to

$timeout : int|bool = false

The timeout value

$username : string = ''
$password : string = ''
$debug_level : int
Return values
bool

connect()

Connect to a POP3 server.

public connect(string $host[, int|bool $port = false ][, int $tval = 30 ]) : bool
Parameters
$host : string
$port : int|bool = false
$tval : int = 30
Return values
bool

disconnect()

Disconnect from the POP3 server.

public disconnect() : mixed
Return values
mixed

getErrors()

Get an array of error messages, if any.

public getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>

login()

Log in to the POP3 server.

public login([string $username = '' ][, string $password = '' ]) : bool

Does not support APOP (RFC 2828, 4949).

Parameters
$username : string = ''
$password : string = ''
Return values
bool

popBeforeSmtp()

Simple static wrapper for all-in-one POP before SMTP.

public static popBeforeSmtp(string $host[, int|bool $port = false ][, int|bool $timeout = false ][, string $username = '' ][, string $password = '' ], int $debug_level) : bool
Parameters
$host : string

The hostname to connect to

$port : int|bool = false

The port number to connect to

$timeout : int|bool = false

The timeout value

$username : string = ''
$password : string = ''
$debug_level : int
Return values
bool

catchWarning()

POP3 connection error handler.

protected catchWarning(int $errno, string $errstr, string $errfile, int $errline) : mixed
Parameters
$errno : int
$errstr : string
$errfile : string
$errline : int
Return values
mixed

checkResponse()

Checks the POP3 server response.

protected checkResponse(string $string) : bool

Looks for for +OK or -ERR.

Parameters
$string : string
Return values
bool

getResponse()

Get a response from the POP3 server.

protected getResponse([int $size = 128 ]) : string
Parameters
$size : int = 128

The maximum number of bytes to retrieve

Return values
string

sendString()

Send raw data to the POP3 server.

protected sendString(string $string) : int
Parameters
$string : string
Return values
int

setError()

Add an error to the internal error store.

protected setError(string $error) : mixed

Also display debug output if it's enabled.

Parameters
$error : string
Return values
mixed

Search results