hi i have this code below for retrieving emails but it collects them in the worng order is there a way i can easily reverse the count so it starts at the maximum and goes back 4 instead of starting at the lowest +4 to the end.
[php]
<?php
// Turn off all error reporting
error_reporting(0);
$mbox = imap_open('{mail.something:110/pop3}', 'username', 'password')
or die("can't connect: " . imap_last_error());
$MC = imap_check($mbox);
$compile ="";
// count how many messages and deduct 4
$count= imap_num_msg($mbox) -3;
// Fetch an overview for all messages in INBOX
//$result = imap_fetch_overview($mbox,"1:{$MC->Nmsgs}",0);
$result = imap_fetch_overview($mbox,$count.":{$MC->Nmsgs}",0);
foreach ($result as $overview) {
$messageNo = $overview->msgno;
//$date= $overview->date;
//$From = $overview->from;
$subject = $overview->subject;
//$message_id = $overview->message_id;
$body = imap_qprint(imap_body($mbox, $messageNo));
//compile to string
$compile .= "".$subject."
".$body."
";
}
echo $compile;
imap_close($mbox);
?>[/php]