Mail_IMAP - A Webmail API for PHP

Donate: If you have found Mail_IMAP to be helpful in your project please express your appreciation by donating to my efforts through my Amazon wishlist.

Mail_IMAP provides a flexible API for connecting to and retrieving mail from mailboxes using the IMAP, POP3 or NNTP mail protocols. Connection to a mailbox is acheived through the c-client extension to PHP. Meaning installation of the c-client extension is required to use Mail_IMAP.

Mail_IMAP can be used to retrieve the contents of a mailbox, whereas it may serve as the backend for a webmail application or mailing list manager.

Since Mail_IMAP is an abstracted object, it allows for complete customization of the UI for any application.

By default Mail_IMAP parses and retrieves information about multipart messages in a threaded fashion similar to MS Outlook, e.g. only top level attachments are retrieved initially, then when message part id and message id are passed to Mail_IMAP, it retrieves attachments and information relevant to that message part. Mail_IMAP::getParts can be supplied an argument to turn off threading, whereas all parts are retrieved at once.

Mail_IMAP also, by default retrieves the alternative message parts of multipart messages. This is most useful for debugging applications that send out multipart mailers where both a text/html and alterntaive text/plain part are included. This can also be turned off by supplying an additional argument to Mail_IMAP::getParts.

Mail_IMAP always searches for a text/html part to display as the primary part. This can be reversed so that it always looks for a text/plain part initially by supplying the necessary arguments to Mail_IMAP::getParts, and Mail_IMAP::getBody.

Note: The Mail_IMAP package name for Mail_IMAP 2 has become Mail_IMAPv2. This was done to follow PEAR naming conventions and to avoid possible conflicts with the IMAP2 protocol. There may be several pages referring to the old package name, Mail_IMAP, in the documentation.

Mail_IMAP 2 Documentation

Warning: Although I have documented Mail_IMAP's private and protected properties and methods, these should be used with caution (if used at all). The API of these properties can change without notice, since I consider this internal functionality of Mail_IMAP. I will tweak these if I decide there's a better way of doing things! Furthermore, access to these methods will be enforced under the upcoming PHP 5 E_STRICT port of Mail_IMAP.

Execution time: 0.06 seconds