@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
@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: 143
@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 IMAP4 Server using the host/ip and port ; If a SSL option is selected will try to establish a SSL socket or fail
publicfunctionnoop (
) {} -> INTEGER+
@return: {INTEGER+} 1 on Success or 0 on Error
Ping the IMAP4 Server
Sends the command NOOP to the Server
publicfunctionreset (
) {} -> INTEGER+
@return: {INTEGER+} 1 on Success or 0 on Error
Reset the IMAP4 server connection (includding all messages marked to be deleted)
@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', 'auth:plain', 'auth:cram-md5', 'auth:xoauth2' ; Default is 'auth:plain'
Try to Login/Authenticate on the IMAP4 Server with a username and password (or token for auth:xoauth2)
Sends both user and pass to the Server
@return: {INTEGER+} 1 on Success or 0 on Failure or Error
@param: {STRING} $mbox_name: The MailBox to Select ; Ex: 'Inbox' or 'Sent' or 'Trash' or 'Spam' or ... 'Sent Items', ...
@param: {BOOLEAN} $allow_create: If MailBox does not exists and this param is set to TRUE then MailBox will be created
Selects a MailBox after login on the IMAP4 Server
Unlike the POP3 servers the IMAP4 servers can operate on multiple MailBoxes over the same account
publicfunctionget_metadata (
) {} -> ARRAY
@return: {ARRAY} Which contains the following keys [ 'uivalidity' => 'CurrentUIV', 'count' => 101, 'recent' => '', 'size' => 1024 ]
Get all the IMAP4 MetaData for the selected account MailBox
publicfunctioncount (
) {} -> ARRAY
@return: {ARRAY} Which contains the following keys [ 'size' => 1024, 'count' => 101, 'recent' => '' ]
Get The Count Information for the selected account MailBox
@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 UID for a specific message or leave empty to get the list with all UIDs
Get the list of UIDs or a specific UID for the selected message
The UID(s) will be formated as this library does: 'IMAP4-UIV-@num@-UID-@uid@'
A list with multiple UIDs provided by this method can be parsed using $imap4->parse_uidls($list)
@hints: Some IMAP4 servers have non-standard responses for the format of $mailget->uid() and in this case you may have to build your own parser ...
@return: {ASSOCIATIVE} ARRAY the list of parsed UIDs as [ id1 => uid1, id2 => uid2, ..., idN => uidN ]
@param: {STRING} $y_list: The UIDs list given by the IMAP4 server with command: $mailget->uid() ; Expects a format similar with: ID[SPACE]UID\n
Parse the (standard) list of UIDs supplied IMAP4 protocol
The UIDs will be formated as this library does: 'IMAP4-UIV-@num@-UID-@uid@'
@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
@param: {BOOLEAN} $by_uid: *Optional* ; Default is FALSE ; If TRUE a Message UID should be supplied for 1st param ; If FALSE a Message Number should be supplied for 1st param
@return: {INTEGER+} 1 on Success or 0 on Failure or Error
@param: {STRING} $msg_num: The Message Number or Message UID if 2nd param is set to TRUE
@param: {BOOLEAN} $by_uid: *Optional* ; Default is FALSE ; If TRUE a Message UID should be supplied for 1st param ; If FALSE a Message Number should be supplied for 1st param
@return: {STRING} The first lines of the message body or empty string on ERROR
@param: {STRING} $msg_num: The Message Number
@param: {BOOLEAN} $by_uid: *Optional* ; Default is FALSE ; If TRUE a Message UID should be supplied for 1st param ; If FALSE a Message Number should be supplied for 1st param
@param: {INTEGER+} $read_lines: The number of lines to retrieve 1..255
Get the Message Head Lines (first lines of the message body)
@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 or Message UID if 2nd param is set to TRUE
@param: {BOOLEAN} $by_uid: *Optional* ; Default is FALSE ; If TRUE a Message UID should be supplied for 1st param ; If FALSE a Message Number should be supplied for 1st param
@return: {INTEGER+} 1 on Success or 0 on Failure or Error
@param: {STRING} $msg_num: The Message Number or Message UID if 3rd param is set to TRUE
@param: {STRING} $dest_mbox: The destination MailBox name ; Ex: 'Trash' or 'Deleted Messages' or 'Archive', ...
@param: {BOOLEAN} $by_uid: *Optional* ; Default is FALSE ; If TRUE a Message UID should be supplied for 1st param ; If FALSE a Message Number should be supplied for 1st param
COPY a Message from the current selected MailBox to another (destination) MailBox
@return: {STRING} The UID of the new uploaded message or Empty string on Error
@param: {STRING} $message: The full message containing the headers and the body as stored locally
STORE an uploaded Message to the current selected MailBox
class Properties
public$buffer = 2048 ; ->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: 2023-10-19 23:15:46 +0000