jakebur01 Posted May 27, 2010 Share Posted May 27, 2010 How can I limit the number of messages returned to 25 and sort them by date? $result = imap_search($mbox,"FROM $customer_email"); echo"<table width=100% border=1>"; foreach ($result as $value) { $mailHeader = @imap_headerinfo($mbox, $value); $from = $mailHeader->fromaddress; $subject = strip_tags($mailHeader->subject); $date = $mailHeader->date; echo "<tr><td>$from</td><td><a href=\"imap_email.php?what=read&eid=$value\" target=\"_blank\">$subject</a></td><td>$date</td><tr>"; } echo"</table>"; imap_close($mbox); Quote Link to comment https://forums.phpfreaks.com/topic/203094-limit-of-messages-returned/ Share on other sites More sharing options...
-Karl- Posted May 27, 2010 Share Posted May 27, 2010 $result = imap_search($mbox,"FROM $customer_email ORDER BY date DESC LIMIT 0,25"); Obviously this won't work, as I don't know what your date table is named. But that's the general idea. Quote Link to comment https://forums.phpfreaks.com/topic/203094-limit-of-messages-returned/#findComment-1064162 Share on other sites More sharing options...
jakebur01 Posted May 27, 2010 Author Share Posted May 27, 2010 It is not a mysql query. Quote Link to comment https://forums.phpfreaks.com/topic/203094-limit-of-messages-returned/#findComment-1064168 Share on other sites More sharing options...
jakebur01 Posted May 27, 2010 Author Share Posted May 27, 2010 Anyone have any ideas? Thanks, Jake Quote Link to comment https://forums.phpfreaks.com/topic/203094-limit-of-messages-returned/#findComment-1064203 Share on other sites More sharing options...
ChaosKnight Posted May 27, 2010 Share Posted May 27, 2010 I don't know how to limit them, but what I do know is you can use the following to filter the results: ALL - return all messages matching the rest of the criteria ANSWERED - match messages with the \ANSWERED flag set BCC "string" - match messages with "string" in the Bcc: field BEFORE "date" - match messages with Date: before "date" BODY "string" - match messages with "string" in the body of the message CC "string" - match messages with "string" in the Cc: field DELETED - match deleted messages FLAGGED - match messages with the \FLAGGED (sometimes referred to as Important or Urgent) flag set FROM "string" - match messages with "string" in the From: field KEYWORD "string" - match messages with "string" as a keyword NEW - match new messages OLD - match old messages ON "date" - match messages with Date: matching "date" RECENT - match messages with the \RECENT flag set SEEN - match messages that have been read (the \SEEN flag is set) SINCE "date" - match messages with Date: after "date" SUBJECT "string" - match messages with "string" in the Subject: TEXT "string" - match messages with text "string" TO "string" - match messages with "string" in the To : UNANSWERED - match messages that have not been answered UNDELETED - match messages that are not deleted UNFLAGGED - match messages that are not flagged UNKEYWORD "string" - match messages that do not have the keyword "string" UNSEEN - match messages which have not been read yet You could use SINCE and limit them that way... Maybe there is some hack available to do what you want it to do? Quote Link to comment https://forums.phpfreaks.com/topic/203094-limit-of-messages-returned/#findComment-1064219 Share on other sites More sharing options...
ChaosKnight Posted May 27, 2010 Share Posted May 27, 2010 I found this for you, hope this is what you need: http://www.php.net/manual/en/function.imap-fetch-overview.php#73891 If you need a pagination script, I can provide one for you that is very effective, I use it all the time... Quote Link to comment https://forums.phpfreaks.com/topic/203094-limit-of-messages-returned/#findComment-1064221 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.