# final class \SmartMailerPop3Client
{ } ->

Class: SmartMailerPop3Client - provides a POP3 Mail Client with SSL/TLS support.

- Language: PHP
- Located at: lib/framework/plugins/lib_mail_get.php
- Package: Plugins:Mailer
- Namespace: \
- Class Name: SmartMailerPop3Client
- Version: v.20231003
- Depends: classes: Smart, SmartUnicode
- Hints: After each operation on the POP3 Server should check the $pop3->error string and if non-empty stop and disconnect to free the socket
- Usage: dynamic object: (new Class())->method() - This class provides only DYNAMIC methods

## class Methods

public function __construct ( $buffer = 0 ) {} @
POP3 Client Class constructor
public function is_connected_and_logged_in ( ) {} ->
Get The Connected + Logged In Status
public function get_selected_mailbox ( ) {} ->
Get The Selected MailBox (on POP3 will be available just after connect + login, no need to select mailbox, there is only one: INBOX)
public function clear_last_error ( ) {} ->
Clear the Last Error
public function set_ssl_tls_ca_file ( STRING $cafile ) {} -> VOID
@return: {VOID}
@param: {STRING} $cafile: Relative Path to a SSL Certificate Authority File (Ex: store within smart-framework/etc/certificates ; specify as 'etc/certificates/ca.pem') ; IMPORTANT: in this case the 'etc/certificates/' directory must be protected with a .htaccess to avoid being public readable - the directory and any files within this directory ...)
Set a SSL/TLS Certificate Authority File
If not set but SMART_FRAMEWORK_SSL_CA_FILE is defined will use the SMART_FRAMEWORK_SSL_CA_FILE
public function connect ( STRING $server, INTEGER+ $port = 110, ENUM $sslversion = "" ) {} -> INTEGER+
@return: {INTEGER+} 1 on success, 0 on fail
@param: {STRING} $server: The Server Hostname or IP address
@param: {INTEGER+} $port: *Optional* The Server Port ; Default is: 110
@param: {ENUM} $sslversion: To connect using SSL mode this must be set to any of these accepted values: '', 'starttls', 'starttls:1.0', 'starttls:1.1', 'starttls:1.2', 'tls', 'tls:1.0', 'tls:1.1', 'tls:1.2', 'ssl', 'sslv3' ; If empty string is set here it will be operate in unsecure mode (NOT using any SSL/TLS Mode)
Will try to open a socket to the specified POP3 Server using the host/ip and port ; If a SSL option is selected will try to establish a SSL socket or fail
public function noop ( ) {} -> INTEGER+
@return: {INTEGER+} 1 on Success or 0 on Error
Ping the POP3 Server
Sends the command NOOP to the Server
public function reset ( ) {} -> INTEGER+
@return: {INTEGER+} 1 on Success or 0 on Error
Reset the POP3 server connection (includding all messages marked to be deleted)
public function quit ( ) {} -> INTEGER+
@return: {INTEGER+} 1 on Success or 0 on Error
Sends the QUIT/LOGOUT commands set to the POP3 server
Closes the communication socket after sending LOGOUT command
public function login ( STRING $username, STRING $pass, ENUM $mode = "" ) {} -> INTEGER+
@return: {INTEGER+} 1 on Success or 0 on Failure or Error
@param: {STRING} $username: The authentication username
@param: {STRING} $pass: The authentication password
@param: {ENUM} $mode: *Optional* The authentication mode ; can be set to any of: 'login', 'apop', 'auth:cram-md5' ; Default is 'login'
Try to Authenticate on the POP3 Server with a username and password
Sends both user and pass to the Server
public function count ( ) {} -> ARRAY
@return: {ARRAY} Which contains the following keys [ 'size' => 1024, 'count' => 101 ]
Get The Count Information for the selected account MailBox
public function uid ( STRING $msg_num = "" ) {} -> STRING
@return: {STRING} A unique UID or a list with multiple (ar all) UIDs ; returns empty string on error
@param: {STRING} $msg_num: *Optional* A specific Message Number for a specific message or leave empty to get the list with all UIDs (all message numbers on the server)
Get the list of UIDs or a specific UID for the selected message
public function size ( STRING $msg_num ) {} -> STRING
@hints: Some servers may not comply with this method and may return empty result
@return: {STRING} the size of the selected message (ussualy in Bytes) or empty string if Error
@param: {STRING} $msg_num: The Message Number
Get the size for the selected message
public function delete ( STRING $msg_num ) {} -> INTEGER+
@return: {INTEGER+} 1 on Success or 0 on Failure or Error
@param: {STRING} $msg_num: The Message Number
Delete a message stored on the POP3 Server
public function header ( STRING $msg_num, INTEGER+ $read_lines = 5 ) {} -> STRING
@return: {STRING} The first lines of the message body or empty string on ERROR
@param: {STRING} $msg_num: The Message Number
@param: {INTEGER+} $read_lines: The number of lines to retrieve 1..255
Get the Message Head Lines (first lines of the message body)
public function read ( STRING $msg_num ) {} -> STRING
@return: {STRING} The full message containing the Message Headers and Body as stored on the server or empty string on ERROR
@param: {STRING} $msg_num: The Message Number
Get the Entire Message from Server

## class Properties

public $buffer = 512 ; -> INT
socket read buffer
public $timeout = 30 ; -> INT
socket timeout in seconds
public $debug = FALSE ; -> BOOLEAN
debug on/off
public $error = '' ; -> STRING
This should be checked after each operation on the server
The error message(s) will be collected here
do not SET a value here, but just GET the result
public $log = '' ; -> STRING
The operations log (only if debug is enabled)
Do not SET a value here, but just GET the result

## class Constants

documentation generated on: 2024-12-16 16:53:45 +0000

Smart.Framework © 2009-2024 unix-world.org