++Using+ Wiki for the Horde/Imap_Client LibraryThese are some basic examples. All examples assume you have a fully configured IMP, and can get the client object from the IMP API: <code type="php"> $imap = $registry->mail->imapOb(); </code> +++Basics ++++Get a list of all messages in the INBOX: <code type="php"> $query = new Horde_Imap_Client_Fetch_Query(); $mbox = new Horde_Imap_Client_Mailbox('INBOX'); // $list is an array of Horde_Imap_Client_Data_Fetch objects. $list = $imap->fetch($mbox, $query); </code> ++++Get a list of messages in INBOX, since a certain date: <code type="php"> $query = new Horde_Imap_Client_Search_Query(); $query->dateSearch( new Horde_Date($date_string), Horde_Imap_Client_Search_Query::DATE_SINCE ); $mbox = new Horde_Imap_Client_Mailbox('INBOX'); // $list is an array of Horde_Imap_Client_Data_Search objecs. $results = $imap->search($mbox, $query); // The list of message uids. var_dump($results['match']); </code> ++++Using the above message ids, fetch the plaintext body of the first email: <code type="php"> $mbox = new Horde_Imap_Client_Mailbox('INBOX'); $query = new Horde_Imap_Client_Fetch_Query(); $query->structure(); $list = $imap->fetch($mbox, $query, array('ids' => $results['match'])); $message = array_pop($list); $uid = $message->getUid(); $part = $message->getStructure(); $id = $part->findBody(); $body = $part->getPart($id); $query2 = new Horde_Imap_Client_Fetch_Query(); $query2->bodyPart($id, array( 'peek' => true, 'decode' => true )); $results = $imap->fetch($mbox, $query2, array('ids' => new Horde_Imap_Client_Ids(array($uid)))); $message2 = array_pop($results); $text = $message2->getBodyPart($id); if (!$message2->getBodyPartDecode($id)) { // Quick way to transfer decode contents $body->setContents($message2->getBodyPart($id)); $text = $body->getContents(); } echo $text; </code>++ Topics * ((Doc/Dev/Imap_Client/IMPAPI|How to get a Client object if IMP's API is available)) * ((Doc/Dev/Imap_Client/Examples|Usage Examples))