\POP3

POP Before SMTP Authentication Class Version 5.2.0

Author: Richard Davey (rich@corephp.co.uk) Modifications: Andy Prevost License: LGPL, see PHPMailer License

Specifically for PHPMailer to allow POP before SMTP authentication. Does not yet work with APOP - if you have an APOP account, contact Richard Davey and we can test changes to this script.

This class is based on the structure of the SMTP class originally authored by Chris Ryan

This class is rfc 1939 compliant and implements all the commands required for POP3 connection, authentication and disconnection.

Summary

Methods
Properties
Constants
__construct()
Authorise()
Connect()
Login()
Disconnect()
$POP3_PORT
$POP3_TIMEOUT
$CRLF
$do_debug
$host
$port
$tval
$username
$password
$Version
No constants found
No protected methods found
No protected properties found
N/A
getResponse()
sendString()
checkResponse()
displayErrors()
catchWarning()
$pop_conn
$connected
$error
N/A

Properties

$POP3_PORT

$POP3_PORT : integer

Default POP3 port

Type

integer

$POP3_TIMEOUT

$POP3_TIMEOUT : integer

Default Timeout

Type

integer

$CRLF

$CRLF : string

POP3 Carriage Return + Line Feed

Type

string

$do_debug

$do_debug : integer

Displaying Debug warnings? (0 = now, 1+ = yes)

Type

integer

$host

$host : string

POP3 Mail Server

Type

string

$port

$port : integer

POP3 Port

Type

integer

$tval

$tval : integer

POP3 Timeout Value

Type

integer

$username

$username : string

POP3 Username

Type

string

$password

$password : string

POP3 Password

Type

string

$Version

$Version : string

Sets the POP3 PHPMailer Version number

Type

string

$pop_conn

$pop_conn : 

Type

$connected

$connected : 

Type

$error

$error : 

Type

Methods

__construct()

__construct() : \POP3

Constructor, sets the initial values

Returns

\POP3

Authorise()

Authorise(string  $host, integer  $port = false, integer  $tval = false, string  $username, string  $password,   $debug_level) 

Combination of public events - connect, login, disconnect

Parameters

string $host
integer $port
integer $tval
string $username
string $password
$debug_level

Connect()

Connect(string  $host, integer  $port = false, integer  $tval = 30) : boolean

Connect to the POP3 server

Parameters

string $host
integer $port
integer $tval

Returns

boolean

Login()

Login(string  $username = '', string  $password = '') : boolean

Login to the POP3 server (does not support APOP yet)

Parameters

string $username
string $password

Returns

boolean

Disconnect()

Disconnect() 

Disconnect from the POP3 server

getResponse()

getResponse(integer  $size = 128) : string

Get the socket response back.

$size is the maximum number of bytes to retrieve

Parameters

integer $size

Returns

string

sendString()

sendString(string  $string) : integer

Send a string down the open socket connection to the POP3 server

Parameters

string $string

Returns

integer

checkResponse()

checkResponse(string  $string) : boolean

Checks the POP3 server response for +OK or -ERR

Parameters

string $string

Returns

boolean

displayErrors()

displayErrors() 

If debug is enabled, display the error message array

catchWarning()

catchWarning(integer  $errno, string  $errstr, string  $errfile, integer  $errline) 

Takes over from PHP for the socket warning handler

Parameters

integer $errno
string $errstr
string $errfile
integer $errline