Jump to content

limit # of messages returned


jakebur01

Recommended Posts

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);

 

Link to comment
https://forums.phpfreaks.com/topic/203094-limit-of-messages-returned/
Share on other sites

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.