+ // use SEARCH/SORT to find recent messages
+ $search_str = 'RECENT';
+ if ($search_request)
+ $search_str .= ' '.$IMAP->search_string;
+
+ $result = $IMAP->search($mbox_name, $search_str, NULL, 'date');
+
+ if ($result) {
+ // get the headers
+ $result_h = $IMAP->list_headers($mbox_name, 1, 'date', 'DESC');
+ // add to the list
+ rcmail_js_message_list($result_h, TRUE);
+ }