UNKNOWN
UNKNOWN = 0
Interface class for accessing an IMAP server
$conn : \rcube_imap_generic
Instance of rcube_imap_generic
$folder_types : array
List of supported special folder types
$icache : array
Internal (in-memory) cache
$all_headers : array
All (additional) headers used (in any way) by Roundcube Not listed here: DATE, FROM, TO, CC, REPLY-TO, SUBJECT, CONTENT-TYPE, LIST-POST (used for messages listing) are hardcoded in rcube_imap_generic::fetchHeaders()
$mcache : \rcube_imap_cache
Instance of rcube_imap_cache
$cache : \rcube_cache
Instance of rcube_cache
connect(string $host, string $user, string $pass, int $port = 143, string $use_ssl = null) : bool
Connect to an IMAP server
| string | $host | Host to connect |
| string | $user | Username for IMAP account |
| string | $pass | Password for IMAP account |
| int | $port | Port to connect to |
| string | $use_ssl | SSL schema (either ssl or tls) or null if plain connection |
True on success, False on failure
set_search_set(array $set) : mixed
Save a search result for future message listing methods
| array | $set | Search set, result from rcube_imap::get_search_set(): 0 - searching criteria, string 1 - search result, rcube_result_index|rcube_result_thread 2 - searching character set, string 3 - sorting field, string 4 - true if sorted, bool |
count(string $folder = '', string $mode = 'ALL', bool $force = false, bool $status = true) : int
Get message count for a specific folder
| string | $folder | Folder name |
| string | $mode | Mode for count [ALL|THREADS|UNSEEN|RECENT|EXISTS] |
| bool | $force | Force reading from server and update cache |
| bool | $status | Enables storing folder status info (max UID/count), required for folder_status() |
Number of messages
list_messages(string $folder = '', int $page = null, string $sort_field = null, string $sort_order = null, int $slice) : array
Public method for listing headers
| string | $folder | Folder name |
| int | $page | Current page to list |
| string | $sort_field | Header field to sort by |
| string | $sort_order | Sort order [ASC|DESC] |
| int | $slice | Number of slice items to extract from result array |
Indexed array with message header objects
index(string $folder = '', string $sort_field = null, string $sort_order = null, bool $no_threads = false, bool $no_search = false) : \rcube_result_index|\rcube_result_thread
Return sorted list of message UIDs
| string | $folder | Folder to get index from |
| string | $sort_field | Sort column |
| string | $sort_order | Sort order [ASC, DESC] |
| bool | $no_threads | Get not threaded index |
| bool | $no_search | Get index not limited to search result (optionally) |
List of messages (UIDs)
search(string $folder = '', string $search = 'ALL', string $charset = null, string $sort_field = null) : \rcube_result_index
Invoke search request to IMAP server
| string | $folder | Folder name to search in |
| string | $search | Search criteria |
| string | $charset | Search charset |
| string | $sort_field | Header field to sort by |
Search result object
get_message_headers(int $uid, string $folder = null, bool $force = false) : \rcube_message_header
Return message headers object of a specific message
| int | $uid | Message UID |
| string | $folder | Folder to read from |
| bool | $force | True to skip cache |
Message headers
get_message_part(int $uid, string $part = 1, \rcube_message_part $o_part = null, mixed $print = null, resource $fp = null, bool $skip_charset_conv = false, int $max_bytes, bool $formatted = true) : string
Fetch message body of a specific message from the server
| int | $uid | Message UID |
| string | $part | Part number |
| \rcube_message_part | $o_part | Part object created by get_structure() |
| mixed | True to print part, resource to write part contents in |
|
| resource | $fp | File pointer to save the message part |
| bool | $skip_charset_conv | Disables charset conversion |
| int | $max_bytes | Only read this number of bytes |
| bool | $formatted | Enables formatting of text/* parts bodies |
Message/part body if not printed
get_raw_body(int $uid, resource $fp = null, string $part = null) : string
Returns the whole message source as string (or saves to a file)
| int | $uid | Message UID |
| resource | $fp | File pointer to save the message |
| string | $part | Optional message part ID |
Message source string
set_flag(mixed $uids, string $flag, string $folder = null, bool $skip_cache = false) : bool
Set message flag to one or several messages
| mixed | $uids | Message UIDs as array or comma-separated string, or '*' |
| string | $flag | Flag to set: SEEN, UNDELETED, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT |
| string | $folder | Folder name |
| bool | $skip_cache | True to skip message cache clean up |
Operation status
unset_flag(mixed $uids, string $flag, string $folder = null) : bool
Remove message flag for one or several messages
| mixed | $uids | Message UIDs as array or comma-separated string, or '*' |
| string | $flag | Flag to unset: SEEN, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT |
| string | $folder | Folder name |
Operation status
save_message(string $folder, string|array $message, string $headers = '', bool $is_file = false, array $flags = [], mixed $date = null, bool $binary = false) : int|bool
Append a mail message (source) to a specific folder
| string | $folder | Target folder |
| string|array | $message | The message source string or filename or array (of strings and file pointers) |
| string | $headers | Headers string if $message contains only the body |
| bool | $is_file | True if $message is a filename |
| array | $flags | Message flags |
| mixed | $date | Message internal date |
| bool | $binary | Enables BINARY append |
Appended message UID or True on success, False on error
move_message(mixed $uids, string $to_mbox, string $from_mbox = '') : bool
Move a message from one folder to another
| mixed | $uids | Message UIDs as array or comma-separated string, or '*' |
| string | $to_mbox | Target folder |
| string | $from_mbox | Source folder |
True on success, False on error
copy_message(mixed $uids, string $to_mbox, string $from_mbox = '') : bool
Copy a message from one folder to another
| mixed | $uids | Message UIDs as array or comma-separated string, or '*' |
| string | $to_mbox | Target folder |
| string | $from_mbox | Source folder |
True on success, False on error
expunge_message(mixed $uids, string $folder = null, bool $clear_cache = true) : bool
Send IMAP expunge command and clear cache
| mixed | $uids | Message UIDs as array or comma-separated string, or '*' |
| string | $folder | Folder name |
| bool | $clear_cache | False if cache should not be cleared |
True on success, False on failure
list_folders_subscribed(string $root = '', string $name = '*', string $filter = null, string $rights = null, bool $skip_sort = false) : array
Public method for listing subscribed folders.
| string | $root | Optional root folder |
| string | $name | Optional name pattern |
| string | $filter | Optional filter |
| string | $rights | Optional ACL requirements |
| bool | $skip_sort | Enable to return unsorted list (for better performance) |
List of folders
list_folders(string $root = '', string $name = '*', mixed $filter = null, string $rights = null, bool $skip_sort = false) : array
Get a list of all folders available on the server
| string | $root | IMAP root dir |
| string | $name | Optional name pattern |
| mixed | $filter | Optional filter |
| string | $rights | Optional ACL requirements |
| bool | $skip_sort | Enable to return unsorted list (for better performance) |
Indexed array with folder names
create_folder(string $folder, bool $subscribe = false, string $type = null, bool $noselect = false) : bool
Create a new folder on the server and register it in local cache
| string | $folder | New folder name |
| bool | $subscribe | True if the new folder should be subscribed |
| string | $type | Optional folder type (junk, trash, drafts, sent, archive) |
| bool | $noselect | Make the folder a \NoSelect folder by adding hierarchy separator at the end (useful for server that do not support both folders and messages as folder children) |
True on success, False on failure
folder_status(string $folder = null, array $diff = []) : int
Returns current status of a folder (compared to the last time use)
We compare the maximum UID to determine the number of new messages because the RECENT flag is not reliable.
| string | $folder | Folder name |
| array | $diff | Difference data |
Folder status
mod_folder(string $folder, string $mode = 'out') : string
Modify folder name according to personal namespace prefix.
For output it removes prefix of the personal namespace if it's possible. For input it adds the prefix. Use it before creating a folder in root of the folders tree.
| string | $folder | Folder name |
| string | $mode | Mode name (out/in) |
Folder name
get_metadata(string $folder, array $entries, array $options = [], bool $force = false) : array
Returns IMAP metadata/annotations (GETMETADATA/GETANNOTATION)
| string | $folder | Folder name (empty for server metadata) |
| array | $entries | Entries |
| array | $options | Command options (with MAXSIZE and DEPTH keys) |
| bool | $force | Disables cache use |
Metadata entry-value hash array on success, NULL on error
get_permflags(string $folder) : array
Returns PERMANENTFLAGS of the specified folder
| string | $folder | Folder name |
Flags
| None found |
| since | 1.2 |
|---|
threads(string $folder) : \rcube_result_thread
Method for fetching threads data
| string | $folder | Folder name |
Thread data object
| None found |
threads_direct(string $folder) : \rcube_result_thread
Method for direct fetching of threads data
| string | $folder | Folder name |
Thread data object
| None found |
fetch_headers(string $folder, array $msgs, bool $sort = true, bool $force = false) : array
Fetches messages headers (by UID)
| string | $folder | Folder name |
| array | $msgs | Message UIDs |
| bool | $sort | Enables result sorting by $msgs |
| bool | $force | Disables cache use |
Messages headers indexed by UID
| None found |
index_direct(string $folder, string $sort_field = null, string $sort_order = null, \rcube_result_index $search = null) : \rcube_result_index
Return sorted list of message UIDs ignoring current search settings.
Doesn't uses cache by default.
| string | $folder | Folder to get index from |
| string | $sort_field | Sort column |
| string | $sort_order | Sort order [ASC, DESC] |
| \rcube_result_index | $search | Optional messages set to limit the result |
Sorted list of message UIDs
| None found |
thread_index(string $folder = '', string $sort_field = null, string $sort_order = null) : \rcube_result_thread
Return index of threaded message UIDs
| string | $folder | Folder to get index from |
| string | $sort_field | Sort column |
| string | $sort_order | Sort order [ASC, DESC] |
Message UIDs
| None found |
convert_criteria(string $str, string $charset, string $dest_charset = 'US-ASCII') : string
Converts charset of search criteria string
| string | $str | Search string |
| string | $charset | Original charset |
| string | $dest_charset | Destination charset (default US-ASCII) |
Search string
| None found |
list_folders_subscribed_direct(string $root = '', string $name = '*') : array
Method for direct folders listing (LSUB)
| string | $root | Optional root folder |
| string | $name | Optional name pattern |
List of subscribed folders
| None found |
list_folders_direct(string $root = '', string $name = '*') : array
Method for direct folders listing (LIST)
| string | $root | Optional root folder |
| string | $name | Optional name pattern |
List of folders
| None found |
set_caching(string $type) : mixed
Enable or disable indexes caching
| string | $type | Cache type (@see rcube::get_cache) |
| None found |
update_cache(string $key, mixed $data) : mixed
Update cache
| string | $key | Cache key |
| mixed | $data | Data |
| None found |
set_messages_caching(bool $set, int $mode = null) : mixed
Enable or disable messages caching
| bool | $set | Flag |
| int | $mode | Cache mode |
| None found |
sort_folder_list(array $a_folders, bool $skip_special = false) : array
Sort folders in alphabetical order. Optionally put special folders first and other-users/shared namespaces last.
| array | $a_folders | Folders list |
| bool | $skip_special | Skip special folders handling |
Sorted list
| None found |
id2uid(int $id, string $folder = null) : int
Find UID of the specified message sequence ID
| int | $id | Message (sequence) ID |
| string | $folder | Folder name |
Message UID
| None found |
debug_handler(mixed $imap, mixed $message) : mixed
This is our own debug handler for the IMAP connection
| mixed | $imap | |
| mixed | $message |
| None found |
parse_uids(mixed $uids) : array
Parse message UIDs input
| mixed | $uids | Message UIDs as array or comma-separated string, or '*' or rcube_result_index object |
Two elements array with UIDs converted to list and ALL flag
| None found |
| None found |
countmessages(string $folder, string $mode = 'ALL', bool $force = false, bool $status = true, bool $no_search = false) : int
Protected method for getting number of messages
| string | $folder | Folder name |
| string | $mode | Mode for count [ALL|THREADS|UNSEEN|RECENT|EXISTS] |
| bool | $force | Force reading from server and update cache |
| bool | $status | Enables storing folder status info (max UID/count), required for folder_status() |
| bool | $no_search | Ignore current search result |
Number of messages
| None found |
_list_messages(string $folder = '', int $page = null, string $sort_field = null, string $sort_order = null, int $slice) : array
protected method for listing message headers
| string | $folder | Folder name |
| int | $page | Current page to list |
| string | $sort_field | Header field to sort by |
| string | $sort_order | Sort order [ASC|DESC] |
| int | $slice | Number of slice items to extract from result array |
Indexed array with message header objects
| None found |
list_thread_messages(string $folder, int $page, int $slice) : array
protected method for listing message headers using threads
| string | $folder | Folder name |
| int | $page | Current page to list |
| int | $slice | Number of slice items to extract from result array |
Indexed array with message header objects
| None found |
fetch_thread_headers(string $folder, \rcube_result_thread $threads, int $page, int $slice) : array
protected method for fetching threaded messages headers
| string | $folder | Folder name |
| \rcube_result_thread | $threads | Threads data object |
| int | $page | List page number |
| int | $slice | Number of threads to slice |
Messages headers
| None found |
set_thread_flags(array $headers, \rcube_result_thread $threads) : array
protected method for setting threaded messages flags: depth, has_children, unread_children, flagged_children
| array | $headers | Reference to headers array indexed by message UID |
| \rcube_result_thread | $threads | Threads data object |
Message headers array indexed by message UID
| None found |
list_search_messages(string $folder, int $page, int $slice) : array
A protected method for listing a set of message headers (search results)
| string | $folder | Folder name |
| int | $page | Current page to list |
| int | $slice | Number of slice items to extract from the result array |
Indexed array with message header objects
| None found |
list_search_thread_messages(string $folder, int $page, int $slice) : array
protected method for listing a set of threaded message headers (search results)
| string | $folder | Folder name |
| int | $page | Current page to list |
| int | $slice | Number of slice items to extract from result array |
Indexed array with message header objects
| None found |
set_folder_stats(string $folder, string $name, mixed $data) : mixed
Stores folder statistic data in session
| string | $folder | Folder name |
| string | $name | Data name |
| mixed | $data | Data value |
| TODO: |
move to separate DB table (cache?) |
|---|
get_folder_stats(string $folder) : array
Gets folder statistic data
| string | $folder | Folder name |
Stats data
| None found |
sort_threads(\rcube_result_thread $threads) : mixed
Sort threaded result, using THREAD=REFS method if available.
If not, use any method and re-sort the result in THREAD=REFS way.
| \rcube_result_thread | $threads | Threads result set |
| None found |
search_index(string $folder, string $criteria = 'ALL', string $charset = null, string $sort_field = null) : \rcube_result_index|\rcube_result_thread
protected search method
| string | $folder | Folder name |
| string | $criteria | Search criteria |
| string | $charset | Charset |
| string | $sort_field | Sorting field |
Search results (UIDs)
| None found |
set_search_dirty(mixed $folder) : mixed
Flag certain result subsets as 'incomplete'.
For subsequent refresh_search() calls to only refresh the updated parts.
| mixed | $folder |
| None found |
structure_part(array $part, int $count, string $parent = '', mixed $mime_headers = null) : mixed
Build message part object
| array | $part | |
| int | $count | |
| string | $parent | |
| mixed | $mime_headers |
| None found |
is_attachment_part(mixed $part) : mixed
Check if the mail structure part is an attachment part and requires fetching the MIME headers for further processing.
| mixed | $part |
| None found |
set_part_filename(\rcube_message_part $part, string $headers = null) : mixed
Set attachment filename from message part structure
| \rcube_message_part | $part | Part object |
| string | $headers | Part's raw headers |
| None found |
structure_charset(array $structure) : string
Get charset name from message structure (first part)
| array | $structure | Message structure |
Charset name
| None found |
list_folders_filter(mixed $result, mixed $root, mixed $update_type = null) : mixed
Apply configured filters on folders list
| mixed | $result | |
| mixed | $root | |
| mixed | $update_type |
| None found |
list_folders_update(array $result, string $type = null) : mixed
Fix folders list by adding folders from other namespaces.
Needed on some servers e.g. Courier IMAP
| array | $result | Reference to folders list |
| string | $type | Listing type (ext-subscribed, subscribed or all) |
| None found |
filter_rights(mixed $a_folders, mixed $rights) : mixed
Filter the given list of folders according to access rights
For performance reasons we assume user has full rights on all personal folders.
| mixed | $a_folders | |
| mixed | $rights |
| None found |
get_fetch_headers() : string
Get message header names for rcube_imap_generic::fetchHeader(s)
Space-separated list of header names
| None found |
md2annotate(string $entry) : array
Converts the METADATA extension entry name into the correct entry-attrib names for older ANNOTATEMORE version.
| string | $entry | Entry name |
Entry-attribute list, NULL if not supported (?)
| None found |
| None found |
| None found |
clear_message_cache(string $folder = null, array $uids = null) : mixed
Clears the messages cache.
| string | $folder | Folder name |
| array | $uids | Optional message UIDs to remove from cache |
| None found |
detect_dual_use_folders() : bool
Determines if server supports dual use folders (those can contain both sub-folders and messages).
| None found |
set_sort_order(string $sort_field, string $sort_order) : mixed
Validate the given input and save to local properties
| string | $sort_field | Sort column |
| string | $sort_order | Sort order |
| None found |
sort_folder_specials(mixed $folder, mixed $list, mixed $specials, mixed $out) : mixed
Recursive function to put subfolders of special folders in place
| mixed | $folder | |
| mixed | $list | |
| mixed | $specials | |
| mixed | $out |
| None found |
sort_folder_comparator(mixed $str1, mixed $str2) : mixed
Callback for uasort() that implements correct locale-aware case-sensitive sorting
| mixed | $str1 | |
| mixed | $str2 |
| None found |
change_subscription(mixed $folders, mixed $mode) : mixed
Subscribe/unsubscribe a list of folders and update local cache
| mixed | $folders | |
| mixed | $mode |
| None found |
set_messagecount(mixed $folder, mixed $mode, mixed $increment) : mixed
Increase/decrease messagecount for a specific folder
| mixed | $folder | |
| mixed | $mode | |
| mixed | $increment |
| None found |
clear_messagecount(mixed $folder, mixed $mode = []) : mixed
Remove messagecount of a specific folder from cache
| mixed | $folder | |
| mixed | $mode |
| None found |
date_format(mixed $date) : mixed
Converts date string/object into IMAP date/time format
| mixed | $date |
| None found |
save_conn_state() : array
Remember state of the IMAP connection (last IMAP command).
Use e.g. if you want to execute more commands and ignore results of these.
Connection state
| None found |
restore_conn_state(array $state) : mixed
Restore saved connection state.
| array | $state | Connection result |
| None found |