Horde/Imap_Client Features


Horde/Imap_Client is orders of magnitude faster than both the PHP imap extension and other native PHP based solutions.

The PHP imap extension produces tremendously inefficient IMAP queries. Horde/Imap_Client has been ruthlessly tuned to eliminate duplicate/unneeded queries. Additionally, Horde/Imap_Client takes advantage of advanced IMAP features, such as pipelining, to reduce the amount of time spent sending commands and waiting for responses.

Memory efficient

Horde/Imap_Client handles message data (which can easily be many MB) entirely within PHP temporary streams. No more than 2 MB of a large data objects is stored in memory at any time so there is no need to worry about PHP out-of-memory issues when working with large messages.

Built-in caching

There is no need to muck around with caching message data; this is all handled transparently within the library. Horde/Imap_Client allows a large variety of caching options to be used, such as:

  • Local files
  • SQL databases
  • NoSQL database (such as MongoDB)
  • Distributed Hash Tables (such as Memcached or Redis)

Standards compliant

Horde/Imap_Client is strictly RFC compliant, so it works out-of-the box with all IMAP servers (even Gmail). Additionally, Horde/Imap_Client natively implements important core functionality that may not be available on your mail server. For example, message threading and FULL sorting (not a limited subset) are always available, regardless of whether your IMAP server supports the THREAD/SORT extensions.

Code quality

Unlike any other PHP IMAP library, Horde/Imap_Client was designed from the ground up to be extensible. This means clean, object-oriented design that allows for easier debugging and ability to add enhancements in the future.

It's the details that matter. For example, Horde/Imap_Client uses a true tokenizer parser to interpret the IMAP commands returned from the server. Most (if not all) other PHP IMAP libraries are using regular expressions to parse this data, which is a prime example of "You're Doing It Wrong (TM)". True lexical tokenizing is faster, uses less memory, and -- most important -- handles improper syntax more elegantly.

Additionally, the code is liberally commented and EVERY publicly accessible API has full documentation. It may not be perfect. But at least we try to give you some idea of what's going on in there.

The library contains hundreds of PHPUnit unit tests that must pass before a release is finalized, to help ensure that upgrading the library will not cause issues to existing code.

Easy debugging

Full logging is available via a single configuration option, including timing information.

Advanced features


Horde/Imap_Client is the ONLY open-source PHP library that supports the CONDSTORE and QRESYNC IMAP extensions. These extensions ensure that changes made by other mail user agents (MUAs) are automatically synchronized. Without CONDSTORE, it is impossible to cache flag information so loading a mailbox on every page access requires parsing every message for flag changes. Additionally, these extensions are absolutely essential to correctly implement an AJAX mail interface that properly synchronizes changes, and to allow synchronization to things like ActiveSync devices.

Access Control Lists (ACLs)

Full ACL support, with abstracted management of the ACLs so that a developer does not need to worry whether a server supports either "old" or "new" style ACLs.

Advanced IMAP extensions

Supports, among other advanced extensions, MULTIAPPEND, BINARY, CATENATE, UIDPLUS, ESEARCH, THREAD/SORT, ESORT, LIST-STATUS, SPECIAL-USE, and MOVE. Most of these extensions were specifically designed for disconnected clients and vastly reduce the amount of bandwidth and processing needed to keep the client synchronized with the server.