@@ -118,7 +118,11 @@ function sqimap_get_sort_order ($imap_stream, $sort, $mbxresponse) {
if ($sort == 6) {
if ($uid_support) {
- $uidnext = $mbxresponse['UIDNEXT']-1;
+ if (isset($mbxresponse['UIDNEXT']) && $mbxresponse['UIDNEXT']) {
+ $uidnext = $mbxresponse['UIDNEXT']-1;
+ } else {
+ $uidnext = '*';
+ }
$uid_query = "$sid SEARCH UID 1:$uidnext\r\n";
fputs($imap_stream, $uid_query);
$uids = sqimap_read_data($imap_stream, $sid, true ,$response, $message);