Converts message identifiers array into sequence-set syntax
string
compressMessageSet
(array $messages, [bool $force = false])
-
array
$messages: Message identifiers
-
bool
$force: Forces compression of any size
Escapes a string when it contains special characters (RFC3501)
string
escape
(string $string, [boolean $force_quotes = false])
-
string
$string: IMAP string
-
boolean
$force_quotes: Forces string quoting (for atoms)
void
getStructurePartArray
( $a, $part)
Returns data of a message part according to specified structure.
array
getStructurePartData
(array $structure, string $part)
-
array
$structure: Message structure (getStructure() result)
-
string
$part: Message part identifier
void
r_implode
( $element)
Converts datetime string into unix timestamp
int
strToTime
(string $date)
-
string
$date: Date string
Splits IMAP response into string tokens
mixed
tokenizeResponse
(string &$str, [int $num = 0])
-
string
&$str: The IMAP's server response
-
int
$num: Number of tokens to return
Converts message sequence-set into array
array
uncompressMessageSet
(string $messages)
-
string
$messages: Message identifiers
Unescapes quoted-string
string
unEscape
(string $string)
-
string
$string: IMAP string
Object constructor
rcube_imap_generic
__construct
()
Handler for IMAP APPEND command
string|bool
append
(string $mailbox, &$message, string $message)
-
string
$mailbox: Mailbox name
-
string
$message: Message content
-
&$message
Handler for IMAP APPEND command.
string|bool
appendFromFile
(string $mailbox, string $path, [string $headers = null])
-
string
$mailbox: Mailbox name
-
string
$path: Path to the file with message body
-
string
$headers: Message headers
DIGEST-MD5/CRAM-MD5/PLAIN Authentication
resource
authenticate
(string $user, string $pass, [string $type = 'PLAIN'])
-
string
$user
-
string
$pass
-
string
$type: Authentication type (PLAIN/CRAM-MD5/DIGEST-MD5)
Removes all messages in a folder
boolean
clearFolder
(string $mailbox)
-
string
$mailbox: Mailbox name
Executes CLOSE command
boolean
close
()
Closes connection with logout.
void
closeConnection
()
Connects to IMAP server and authenticates.
bool
connect
(string $host, string $user, string $password, [array $options = null])
-
string
$host: Server hostname or IP
-
string
$user: User name
-
string
$password: Password
-
array
$options: Connection and class options
Checks connection status
bool
connected
()
Copies message(s) from one folder to another
bool
copy
(string|array $messages, string $from, string $to)
-
string|array
$messages: Message UID(s)
-
string
$from: Mailbox name
-
string
$to: Destination mailbox name
Returns count of all messages in a folder
int
countMessages
(string $mailbox, [ $refresh = false])
-
string
$mailbox: Mailbox name
-
$refresh
Returns count of messages with \Recent flag in a folder
int
countRecent
(string $mailbox)
-
string
$mailbox: Mailbox name
Returns count of messages without \Seen flag in a specified folder
int
countUnseen
(string $mailbox)
-
string
$mailbox: Mailbox name
Folder creation (CREATE)
bool
createFolder
(string $mailbox)
-
string
$mailbox: Mailbox name
Send the DELETEACL command (RFC4314)
boolean
deleteACL
(string $mailbox, string $user)
-
string
$mailbox: Mailbox name
-
string
$user: User name
Send the SETANNOTATION command with NIL values (draft-daboo-imap-annotatemore)
boolean
deleteAnnotation
(string $mailbox, array $data)
-
string
$mailbox: Mailbox name
-
array
$data: Data array where each item is an array with two elements: entry name and attribute name
Executes DELETE command
boolean
deleteFolder
(string $mailbox)
-
string
$mailbox: Mailbox name
Send the SETMETADATA command with NIL values (RFC5464)
boolean
deleteMetadata
(string $mailbox, array $entries)
-
string
$mailbox: Mailbox name
-
array
$entries: Entry names array
Executes ENABLE command (RFC5161)
array|bool
enable
(mixed $extension)
-
mixed
$extension: Extension name to enable (or array of names)
Sends IMAP command and parses result
mixed
execute
(string $command, [array $arguments = array()], [int $options = 0])
-
string
$command: IMAP command
-
array
$arguments: Command arguments
-
int
$options: Execution options
Executes EXPUNGE command
boolean
expunge
(string $mailbox, [string $messages = NULL])
-
string
$mailbox: Mailbox name
-
string
$messages: Message UIDs to expunge
FETCH command (RFC3501)
array
fetch
(string $mailbox, mixed $message_set, [bool $is_uid = false], [array $query_items = array()], [string $mod_seq = null], [bool $vanished = false])
-
string
$mailbox: Mailbox name
-
mixed
$message_set: Message(s) sequence identifier(s) or UID(s)
-
bool
$is_uid: True if $message_set contains UIDs
-
array
$query_items: FETCH command data items
-
string
$mod_seq: Modification sequence for CHANGEDSINCE (RFC4551) query
-
bool
$vanished: Enables VANISHED parameter (RFC5162) for CHANGEDSINCE query
void
fetchHeader
( $mailbox, $id, [ $uidfetch = false], [ $bodystr = false], [ $add = ''])
-
$mailbox
-
$id
-
$uidfetch
-
$bodystr
-
$add
void
fetchHeaderIndex
( $mailbox, $message_set, [ $index_field = ''], [ $skip_deleted = true], [ $uidfetch = false], [ $return_uid = false])
-
$mailbox
-
$message_set
-
$index_field
-
$skip_deleted
-
$uidfetch
-
$return_uid
void
fetchHeaders
( $mailbox, $message_set, [ $is_uid = false], [ $bodystr = false], [ $add = ''])
-
$mailbox
-
$message_set
-
$is_uid
-
$bodystr
-
$add
void
fetchMIMEHeaders
( $mailbox, $uid, $parts, [ $mime = true])
-
$mailbox
-
$uid
-
$parts
-
$mime
void
fetchPartHeader
( $mailbox, $id, [ $is_uid = false], [ $part = NULL])
-
$mailbox
-
$id
-
$is_uid
-
$part
Sets flag of the message(s)
bool
flag
(string $mailbox, string|array $messages, string $flag)
-
string
$mailbox: Mailbox name
-
string|array
$messages: Message UID(s)
-
string
$flag: Flag name
Send the GETACL command (RFC4314)
array
getACL
(string $mailbox)
-
string
$mailbox: Mailbox name
Send the GETANNOTATION command (draft-daboo-imap-annotatemore)
array
getAnnotation
(string $mailbox, array $entries, array $attribs)
-
string
$mailbox: Mailbox name
-
array
$entries: Entries names
-
array
$attribs: Attribs names
Capabilities checker
mixed
getCapability
(string $name)
-
string
$name: Capability name
Detects hierarchy delimiter
string
getHierarchyDelimiter
()
Send the GETMETADATA command (RFC5464)
array
getMetadata
(string $mailbox, array $entries, [array $options = array()])
-
string
$mailbox: Mailbox name
-
array
$entries: Entries
-
array
$options: Command options (with MAXSIZE and DEPTH keys)
NAMESPACE handler (RFC 2342)
array
getNamespace
()
Returns QUOTA information
array
getQuota
()
Returns BODYSTRUCTURE for the specified message.
array/bool
getStructure
(string $mailbox, int $id, [bool $is_uid = false])
-
string
$mailbox: Folder name
-
int
$id: Message sequence number or UID
-
bool
$is_uid: True if $id is an UID
void
handlePartBody
( $mailbox, $id, [ $is_uid = false], [ $part = ''], [ $encoding = NULL], [ $print = NULL], [ $file = NULL])
-
$mailbox
-
$id
-
$is_uid
-
$part
-
$encoding
-
$print
-
$file
Executes ID command (RFC2971)
array
id
([array $items = array()])
-
array
$items: Client identification information key/value hash
Returns message unique identifier (UID)
int
ID2UID
(string $mailbox, $id, int $uid)
-
string
$mailbox: Mailbox name
-
int
$uid: Message sequence identifier
-
$id
Simulates SORT command by using FETCH and sorting.
rcube_result_index
index
(
string $mailbox,
string|array $message_set, [
string $index_field =
''], [
bool $skip_deleted =
true], [
bool $uidfetch =
false], [
bool $return_uid =
false])
-
string
$mailbox: Mailbox name
-
string|array
$message_set: Searching criteria (list of messages to return)
-
string
$index_field: Field to sort by (ARRIVAL, CC, DATE, FROM, SIZE, SUBJECT, TO)
-
bool
$skip_deleted: Makes that DELETED messages will be skipped
-
bool
$uidfetch: Enables UID FETCH usage
-
bool
$return_uid: Enables returning UIDs instead of IDs
Returns list of mailboxes
array
listMailboxes
(string $ref, string $mailbox, [array $status_opts = array()], [array $select_opts = array()])
-
string
$ref: Reference name
-
string
$mailbox: Mailbox name
-
array
$status_opts: (see self::_listMailboxes)
-
array
$select_opts: (see self::_listMailboxes)
Send the LISTRIGHTS command (RFC4314)
array
listRights
(string $mailbox, string $user)
-
string
$mailbox: Mailbox name
-
string
$user: User name
Returns list of subscribed mailboxes
array
listSubscribed
(string $ref, string $mailbox, [array $status_opts = array()])
-
string
$ref: Reference name
-
string
$mailbox: Mailbox name
-
array
$status_opts: (see self::_listMailboxes)
LOGIN Authentication
resource
login
(string $user, $password, string $pass)
-
string
$user
-
string
$pass
-
$password
Moves message(s) from one folder to another.
Original message(s) will be marked as deleted.
bool
move
(string|array $messages, string $from, string $to)
-
string|array
$messages: Message UID(s)
-
string
$from: Mailbox name
-
string
$to: Destination mailbox name
Reads more data from the connection stream when provided data contain string literal
string
multLine
(string $line, [bool $escape = false])
-
string
$line: Response text
-
bool
$escape: Enables escaping
Send the MYRIGHTS command (RFC4314)
array
myRights
(string $mailbox)
-
string
$mailbox: Mailbox name
Creates next command identifier (tag)
string
nextTag
()
Response parser.
int
parseResult
(string $string, [string $err_prefix = ''])
-
string
$string: Response text
-
string
$err_prefix: Error message prefix
Send simple (one line) command to the connection stream
void
putLine
(string $string, [bool $endln = true], int 2)
-
string
$string: Command string
-
bool
$endln: True if CRLF need to be added at the end of command
-
int
2: Number of bytes sent, False on error
Send command to the connection stream with Command Continuation Requests (RFC3501 7.5) and LITERAL+ (RFC2088) support
int|bool
putLineC
(string $string, [bool $endln = true])
-
string
$string: Command string
-
bool
$endln: True if CRLF need to be added at the end of command
Reads specified number of bytes from the connection stream
string
readBytes
(int $bytes)
-
int
$bytes: Number of bytes to get
Reads line from the connection stream
string
readLine
([int $size = 1024])
Reads complete response to the IMAP command
string
readReply
([ &$untagged = null], array $untagged)
-
array
$untagged: Will be filled with untagged response lines
-
&$untagged
Folder renaming (RENAME)
bool
renameFolder
( $from, $to, string $mailbox)
-
string
$mailbox: Mailbox name
-
$from
-
$to
Executes SEARCH command
rcube_result_index
search
(
string $mailbox,
string $criteria, [
bool $return_uid =
false], [
array $items =
array()])
-
string
$mailbox: Mailbox name
-
string
$criteria: Searching criteria
-
bool
$return_uid: Enable UID in result instead of sequence ID
-
array
$items: Return items (MIN, MAX, COUNT, ALL)
Executes SELECT command (if mailbox is already not in selected state)
boolean
select
(string $mailbox, [array $qresync_data = null])
-
string
$mailbox: Mailbox name
-
array
$qresync_data: QRESYNC data (RFC5162)
Send the SETACL command (RFC4314)
boolean
setACL
(string $mailbox, string $user, mixed $acl)
-
string
$mailbox: Mailbox name
-
string
$user: User name
-
mixed
$acl: ACL string or array
Send the SETANNOTATION command (draft-daboo-imap-annotatemore)
boolean
setAnnotation
(string $mailbox, array $data)
-
string
$mailbox: Mailbox name
-
array
$data: Data array where each item is an array with three elements: entry name, attribute name, value
Set the value of the debugging flag.
void
setDebug
(boolean $debug, [ $handler = null])
-
boolean
$debug: New value for the debugging flag.
-
$handler
Error code/message setter.
void
setError
( $code, [ $msg = ''])
Send the SETMETADATA command (RFC5464)
boolean
setMetadata
(string $mailbox, array $entries)
-
string
$mailbox: Mailbox name
-
array
$entries: Entry-value array (use NULL value as NIL)
Executes SORT command
rcube_result_index
sort
(
string $mailbox,
string $field, [
string $add =
''], [
bool $return_uid =
false], [
string $encoding =
'US-ASCII'])
-
string
$mailbox: Mailbox name
-
string
$field: Field to sort by (ARRIVAL, CC, DATE, FROM, SIZE, SUBJECT, TO)
-
string
$add: Searching criteria
-
bool
$return_uid: Enables UID SORT usage
-
string
$encoding: Character set
void
sortHeaders
( $a, $field, $flag)
Checks response status.
Checks if command response line starts with specified prefix (or * BYE/BAD)
bool
startsWith
(string $string, string $match, [bool $error = false], [bool $nonempty = false])
-
string
$string: Response text
-
string
$match: Prefix to match with (case-sensitive)
-
bool
$error: Enables BYE/BAD checking
-
bool
$nonempty: Enables empty response checking
Executes STATUS command
array
status
(string $mailbox, [array $items = array()])
-
string
$mailbox: Mailbox name
-
array
$items: Additional requested item names. By default MESSAGES and UNSEEN are requested. Other defined in RFC3501: UIDNEXT, UIDVALIDITY, RECENT
Folder subscription (SUBSCRIBE)
boolean
subscribe
(string $mailbox)
-
string
$mailbox: Mailbox name
Executes THREAD command
rcube_result_thread
thread
(
string $mailbox, [
string $algorithm =
'REFERENCES'], [
string $criteria =
''], [
bool $return_uid =
false], [
string $encoding =
'US-ASCII'])
-
string
$mailbox: Mailbox name
-
string
$algorithm: Threading algorithm (ORDEREDSUBJECT, REFERENCES, REFS)
-
string
$criteria: Searching criteria
-
bool
$return_uid: Enables UIDs in result instead of sequence numbers
-
string
$encoding: Character set
Returns message sequence identifier
int
UID2ID
(string $mailbox, int $uid)
-
string
$mailbox: Mailbox name
-
int
$uid: Message unique identifier (UID)
Unsets flag of the message(s)
bool
unflag
(string $mailbox, string|array $messages, string $flag)
-
string
$mailbox: Mailbox name
-
string|array
$messages: Message UID(s)
-
string
$flag: Flag name
Folder unsubscription (UNSUBSCRIBE)
boolean
unsubscribe
(string $mailbox)
-
string
$mailbox: Mailbox name