note 87694 added to function.imap-sort

From: Date: Wed, 17 Dec 2008 05:16:58 +0000
Subject: note 87694 added to function.imap-sort
Groups: php.notes 
Request: Send a blank email to php-notes+get-148242@lists.php.net to get a copy of this message
One thing worth mentioning about imap_sort is that the unique id and message no. changes with the order of the message, so the ids are different if sorted differently and have difficulties to track, the way to get it is using the message->id property: [code]<?php $imap_server = "{mail.netfriending.co.cc/novalidate-cert}"; $imap_user = "user"; $imap_pass = "pass"; $mbox = imap_open("{$imap_server}INBOX", $imap_user, $imap_pass); $original_order = $mbox;//this is important line to add before reordering the messages. $sorted_mbox = imap_sort($mbox, "SORTDATE", 0); $totalrows = imap_num_msg($mbox); $startvalue = 0; while ($startvalue < $totalrows) { $header = imap_header($mbox, $sorted_mbox[$startvalue]); $mid_1 = $header->message_id; $i = 0; while ($i < ($totalrows + 1)) {$header1 = imap_header($original_order, $i); $mid_2 = $header1->message_id; if ($mid_1 == $mid_2) {$id = $i;} $i ++;}//now the ids are store truely & uniquely in the $id variable to call out $startvalue ++;} ?> [/code] ---- Server IP: 209.41.74.194 Probable Submitter: 150.135.92.15 ---- Manual Page -- http://www.php.net/manual/en/function.imap-sort.php Edit -- https://master.php.net/note/edit/87694 Del: integrated -- https://master.php.net/note/delete/87694/integrated Del: useless -- https://master.php.net/note/delete/87694/useless Del: bad code -- https://master.php.net/note/delete/87694/bad+code Del: spam -- https://master.php.net/note/delete/87694/spam Del: non-english -- https://master.php.net/note/delete/87694/non-english Del: in docs -- https://master.php.net/note/delete/87694/in+docs Del: other reasons-- https://master.php.net/note/delete/87694 Reject -- https://master.php.net/note/reject/87694 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#148242) next »