6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This implements functions that manipulate messages
14 /* Copies specified messages to specified folder */
16 function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) {
18 $read = sqimap_run_command ($imap_stream, "COPY $start:$end \"$mailbox\"", true, $response, $message, $uid_support);
21 function sqimap_msgs_list_copy ($imap_stream, $id, $mailbox) {
23 $msgs_id = sqimap_message_list_squisher($id);
24 $read = sqimap_run_command ($imap_stream, "COPY $msgs_id \"$mailbox\"", true, $response, $message, $uid_support);
25 $read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response, $message, $uid_support);
29 /* Deletes specified messages and moves them to trash if possible */
31 function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox) {
32 global $move_to_trash, $trash_folder, $auto_expunge, $uid_support;
34 if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) {
35 sqimap_messages_copy ($imap_stream, $start, $end, $trash_folder);
37 sqimap_messages_flag ($imap_stream, $start, $end, "Deleted", true);
40 function sqimap_msgs_list_delete ($imap_stream, $mailbox, $id) {
41 global $move_to_trash, $trash_folder, $uid_support;
42 $msgs_id = sqimap_message_list_squisher($id);
43 if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) {
44 $read = sqimap_run_command ($imap_stream, "COPY $msgs_id \"$trash_folder\"", true, $response, $message, $uid_support);
46 $read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response, $message, $uid_support);
50 /* Sets the specified messages with specified flag */
51 function sqimap_messages_flag ($imap_stream, $start, $end, $flag, $handle_errors) {
53 $read = sqimap_run_command ($imap_stream, "STORE $start:$end +FLAGS (\\$flag)", $handle_errors, $response, $message, $uid_support);
56 /* Remove specified flag from specified messages */
57 function sqimap_messages_remove_flag ($imap_stream, $start, $end, $flag, $handle_errors) {
59 $read = sqimap_run_command ($imap_stream, "STORE $start:$end -FLAGS (\\$flag)", $handle_errors, $response, $message, $uid_support);
62 function sqimap_toggle_flag($imap_stream, $id, $flag, $set, $handle_errors) {
64 $msgs_id = sqimap_message_list_squisher($id);
65 $set_string = ($set ?
'+' : '-');
66 $read = sqimap_run_command ($imap_stream, "STORE $msgs_id ".$set_string."FLAGS ($flag)", $handle_errors, $response, $message, $uid_support);
69 function sqimap_get_small_header ($imap_stream, $id, $sent) {
70 $res = sqimap_get_small_header_list($imap_stream, $id, $sent);
75 * Sort the message list and crunch to be as small as possible
76 * (overflow could happen, so make it small if possible)
78 function sqimap_message_list_squisher($messages_array) {
79 if( !is_array( $messages_array ) ) {
80 return $messages_array;
83 sort($messages_array, SORT_NUMERIC
);
85 while ($messages_array) {
86 $start = array_shift($messages_array);
88 while (isset($messages_array[0]) && $messages_array[0] == $end +
1) {
89 $end = array_shift($messages_array);
91 if ($msgs_str != '') {
96 $msgs_str .= ':' . $end;
102 /* returns the references header lines */
103 function get_reference_header ($imap_stream, $message) {
105 $responses = array ();
106 $sid = sqimap_session_id($uid_support);
109 $query = "$sid FETCH $message BODY[HEADER.FIELDS (References)]\r\n";
110 fputs ($imap_stream, $query);
111 $responses = sqimap_read_data_list($imap_stream, $sid, true, $responses, $message);
112 if (!eregi("^\\* ([0-9]+) FETCH", $responses[0][0], $regs)) {
113 $responses = array ();
119 /* get sort order from server and
120 * return it as the $id array for
124 function sqimap_get_sort_order ($imap_stream, $sort, $mbxresponse) {
125 global $default_charset, $thread_sort_messages,
126 $internal_date_sort, $server_sort_array,
127 $sent_folder, $mailbox, $uid_support;
129 if (sqsession_is_registered('server_sort_array')) {
130 sqsession_unregister('server_sort_array');
133 $sid = sqimap_session_id($uid_support);
136 $server_sort_array = array();
137 $sort_test = array();
142 if (isset($mbxresponse['UIDNEXT']) && $mbxresponse['UIDNEXT']) {
143 $uidnext = $mbxresponse['UIDNEXT']-1;
147 $uid_query = "$sid SEARCH UID 1:$uidnext\r\n";
148 fputs($imap_stream, $uid_query);
149 $uids = sqimap_read_data($imap_stream, $sid, true ,$response, $message);
150 if (isset($uids[0])) {
151 if (preg_match("/^\* SEARCH (.+)$/", $uids[0], $regs)) {
152 $server_sort_array = preg_split("/ /", trim($regs[1]));
155 if (!preg_match("/OK/", $response)) {
156 $server_sort_array = 'no';
159 $qty = $mbxresponse['EXISTS'];
160 $server_sort_array = range(1, $qty);
162 $server_sort_array = array_reverse($server_sort_array);
163 sqsession_register($server_sort_array, 'server_sort_array');
164 return $server_sort_array;
167 $sort_on = array (0=> 'DATE',
173 if ($internal_date_sort == true) {
174 $sort_on[0] = 'ARRIVAL';
175 $sort_on[1] = 'ARRIVAL';
177 if ($sent_folder == $mailbox) {
181 if (!empty($sort_on[$sort])) {
182 $sort_query = "$sid SORT ($sort_on[$sort]) ".strtoupper($default_charset)." ALL\r\n";
183 fputs($imap_stream, $sort_query);
184 $sort_test = sqimap_read_data($imap_stream, $sid, true ,$response, $message);
186 if (isset($sort_test[0])) {
187 if (preg_match("/^\* SORT (.+)$/", $sort_test[0], $regs)) {
188 $server_sort_array = preg_split("/ /", trim($regs[1]));
191 if ($sort == 0 ||
$sort == 2 ||
$sort == 4) {
192 $server_sort_array = array_reverse($server_sort_array);
194 if (!preg_match("/OK/", $response)) {
195 $server_sort_array = 'no';
197 sqsession_register($server_sort_array, 'server_sort_array');
198 return $server_sort_array;
202 function sqimap_get_php_sort_order ($imap_stream, $mbxresponse) {
205 if (sqsession_is_registered('php_sort_array')) {
206 sqsession_unregister('php_sort_array');
209 $sid = sqimap_session_id($uid_support);
210 $php_sort_array = array();
213 if (isset($mbxresponse['UIDNEXT']) && $mbxresponse['UIDNEXT']) {
214 $uidnext = $mbxresponse['UIDNEXT']-1;
218 $uid_query = "$sid SEARCH UID 1:$uidnext\r\n";
219 fputs($imap_stream, $uid_query);
220 $uids = sqimap_read_data($imap_stream, $sid, true ,$response, $message);
221 if (isset($uids[0])) {
222 if (preg_match("/^\* SEARCH (.+)$/", $uids[0], $regs)) {
223 $php_sort_array = preg_split("/ /", trim($regs[1]));
226 if (!preg_match("/OK/", $response)) {
227 $php_sort_array = 'no';
230 $qty = $mbxresponse['EXISTS'];
231 $php_sort_array = range(1, $qty);
233 sqsession_register($php_sort_array, 'php_sort_array');
234 return $php_sort_array;
238 /* returns an indent array for printMessageinfo()
239 this represents the amount of indent needed (value)
240 for this message number (key)
243 function get_parent_level ($imap_stream) {
244 global $sort_by_ref, $default_charset, $thread_new;
249 /* loop through the threads and take unwanted characters out
250 of the thread string then chop it up
252 for ($i=0;$i<count($thread_new);$i++
) {
253 $thread_new[$i] = preg_replace("/\s\(/", "(", $thread_new[$i]);
254 $thread_new[$i] = preg_replace("/(\d+)/", "$1|", $thread_new[$i]);
255 $thread_new[$i] = preg_split("/\|/", $thread_new[$i], -1, PREG_SPLIT_NO_EMPTY
);
257 $indent_array = array();
259 $thread_new = array();
261 /* looping through the parts of one message thread */
263 for ($i=0;$i<count($thread_new);$i++
) {
264 /* first grab the parent, it does not indent */
266 if (isset($thread_new[$i][0])) {
267 if (preg_match("/(\d+)/", $thread_new[$i][0], $regs)) {
271 $indent_array[$parent] = 0;
273 /* now the children, checking each thread portion for
274 ),(, and space, adjusting the level and space values
275 to get the indent level
282 for ($k=1;$k<(count($thread_new[$i]))-1;$k++
) {
283 $chars = count_chars($thread_new[$i][$k], 1);
284 if (isset($chars['40'])) { /* testing for ( */
285 $level = $level +
$chars['40'];
287 if (isset($chars['41'])) { /* testing for ) */
288 $level = $level - $chars['41'];
290 /* if we were faking lets stop, this portion
291 of the thread is over
293 if ($level == $cutoff) {
297 if (isset($chars['32'])) { /* testing for space */
298 if (!isset($spaces[$level])) {
301 $spaces[$level] = $spaces[$level] +
$chars['32'];
303 for ($x=0;$x<=$level;$x++
) {
304 if (isset($spaces[$x])) {
305 $spaces_total = $spaces_total +
$spaces[$x];
308 $indent = $level +
$spaces_total;
309 /* must have run into a message that broke the thread
310 so we are adjusting for that portion
313 $indent = $indent +
1;
315 if (preg_match("/(\d+)/", $thread_new[$i][$k], $regs)) {
318 /* the thread must be broken if $indent == 0
319 so indent the message once and start faking it
326 /* dont need abs but if indent was negative
329 $indent_array[$child] = abs($indent);
333 return $indent_array;
337 /* returns an array with each element as a string
338 representing one message thread as returned by
342 function get_thread_sort ($imap_stream) {
343 global $thread_new, $sort_by_ref, $default_charset, $server_sort_array, $uid_support;
344 if (sqsession_is_registered('thread_new')) {
345 sqsession_unregister('thread_new');
347 if (sqsession_is_registered('server_sort_array')) {
348 sqsession_unregister('server_sort_array');
350 $sid = sqimap_session_id($uid_support);
351 $thread_temp = array ();
352 if ($sort_by_ref == 1) {
353 $sort_type = 'REFERENCES';
356 $sort_type = 'ORDEREDSUBJECT';
358 $thread_query = "$sid THREAD $sort_type ".strtoupper($default_charset)." ALL\r\n";
359 fputs($imap_stream, $thread_query);
360 $thread_test = sqimap_read_data($imap_stream, $sid, false, $response, $message);
361 if (isset($thread_test[0])) {
362 if (preg_match("/^\* THREAD (.+)$/", $thread_test[0], $regs)) {
363 $thread_list = trim($regs[1]);
369 if (!preg_match("/OK/", $response)) {
370 $server_sort_array = 'no';
371 return $server_sort_array;
373 if (isset($thread_list)) {
374 $thread_temp = preg_split("//", $thread_list, -1, PREG_SPLIT_NO_EMPTY
);
376 $char_count = count($thread_temp);
378 $thread_new = array();
381 for ($i=0;$i<$char_count;$i++
) {
382 if ($thread_temp[$i] != ')' && $thread_temp[$i] != '(') {
383 $thread_new[$k] = $thread_new[$k] . $thread_temp[$i];
385 elseif ($thread_temp[$i] == '(') {
386 $thread_new[$k] .= $thread_temp[$i];
389 elseif ($thread_temp[$i] == ')') {
391 $thread_new[$k] .= $thread_temp[$i];
392 $counter = $counter - 1;
395 $thread_new[$k] .= $thread_temp[$i];
397 $thread_new[$k] = "";
398 $counter = $counter - 1;
402 sqsession_register($thread_new, 'thread_new');
403 $thread_new = array_reverse($thread_new);
404 $thread_list = implode(" ", $thread_new);
405 $thread_list = str_replace("(", " ", $thread_list);
406 $thread_list = str_replace(")", " ", $thread_list);
407 $thread_list = preg_split("/\s/", $thread_list, -1, PREG_SPLIT_NO_EMPTY
);
408 $server_sort_array = $thread_list;
409 sqsession_register($server_sort_array, 'server_sort_array');
414 function elapsedTime($start) {
415 $stop = gettimeofday();
416 $timepassed = 1000000 * ($stop['sec'] - $start['sec']) +
$stop['usec'] - $start['usec'];
420 function sqimap_get_small_header_list ($imap_stream, $msg_list) {
421 global $squirrelmail_language, $color, $data_dir, $username, $imap_server_type;
422 global $uid_support, $allow_server_sort;
424 /* Get the small headers for each message in $msg_list */
425 $sid = sqimap_session_id($uid_support);
427 $maxmsg = sizeof($msg_list);
429 $msgs_str = sqimap_message_list_squisher($msg_list);
431 $read_list = array();
433 * We need to return the data in the same order as the caller supplied
434 * in $msg_list, but IMAP servers are free to return responses in
435 * whatever order they wish... So we need to re-sort manually
437 for ($i = 0; $i < sizeof($msg_list); $i++
) {
438 $id2index[$msg_list[$i]] = $i;
441 $internaldate = getPref($data_dir, $username, 'internal_date_sort');
443 $query = "$sid FETCH $msgs_str (FLAGS UID RFC822.SIZE INTERNALDATE BODY.PEEK[HEADER.FIELDS (Date To Cc From Subject X-Priority Content-Type)])\r\n";
445 $query = "$sid FETCH $msgs_str (FLAGS UID RFC822.SIZE BODY.PEEK[HEADER.FIELDS (Date To Cc From Subject X-Priority Content-Type)])\r\n";
447 fputs ($imap_stream, $query);
448 $readin_list = sqimap_read_data_list($imap_stream, $sid, false, $response, $message);
450 foreach ($readin_list as $r) {
452 if (!preg_match("/^\\*\s+([0-9]+)\s+FETCH/iAU",$r[0], $regs)) {
453 set_up_language($squirrelmail_language);
454 echo '<br><b><font color=$color[2]>' .
455 _("ERROR : Could not complete request.") .
457 _("Unknown response from IMAP server: ") . ' 1.' .
458 htmlspecialchars($r[0]) . "</font><br>\n";
459 } else if (! isset($id2index[$regs[1]]) ||
!count($id2index[$regs[1]])) {
460 set_up_language($squirrelmail_language);
461 echo '<br><b><font color=$color[2]>' .
462 _("ERROR : Could not complete request.") .
464 _("Unknown message number in reply from server: ") .
465 htmlspecialchars($regs[1]) . "</font><br>\n";
467 $read_list[$id2index[$regs[1]]] = $r;
470 if (!preg_match("/^\\*\s+([0-9]+)\s+FETCH.*UID\s+([0-9]+)\s+/iAU",$r[0], $regs)) {
471 set_up_language($squirrelmail_language);
472 echo '<br><b><font color=$color[2]>' .
473 _("ERROR : Could not complete request.") .
475 _("Unknown response from IMAP server: ") . ' 1.' .
476 htmlspecialchars($r[0]) . "</font><br>\n";
477 } else if (! isset($id2index[$regs[2]]) ||
!count($id2index[$regs[2]])) {
478 set_up_language($squirrelmail_language);
479 echo '<br><b><font color=$color[2]>' .
480 _("ERROR : Could not complete request.") .
482 _("Unknown message number in reply from server: ") .
483 htmlspecialchars($regs[2]) . "</font><br>\n";
485 $read_list[$id2index[$regs[2]]] = $r;
486 $unique_id = $regs[2];
495 "/^X-Priority:(.*)\$/AUi",
498 "/^Subject:(.*)\$/AUi",
499 "/^Content-Type:(.*)\$/AUi"
503 for ($msgi = 0; $msgi < $maxmsg; $msgi++
) {
504 $subject = _("(no subject)");
505 $from = _("Unknown Sender");
508 $cc = $to = $date = $type[0] = $type[1] = $inrepto = '';
509 $flag_seen = $flag_answered = $flag_deleted = $flag_flagged = false;
510 $read = $read_list[$msgi];
513 foreach ($read as $read_part) {
514 //unfold multi-line headers
515 if ($prevline && $prevline{strlen($prevline)-1} == "\n"
516 && ($read_part{0} == ' ' ||
$read_part{0} == "\t")) {
517 $read_part = substr($prevline, 0, -2) . preg_replace('/(\t\s+)/',' ',$read_part);
519 $prevline = $read_part;
520 if ($read_part{0} == '*') {
522 if (preg_match ("/^.+INTERNALDATE\s+\"(.+)\".+/iUA",$read_part, $reg)) {
523 $tmpdate = trim($reg[1]);
524 $tmpdate = str_replace(' ',' ',$tmpdate);
525 $tmpdate = explode(' ',$tmpdate);
526 $date = str_replace('-',' ',$tmpdate[0]) . " " .
531 if (preg_match ("/^.+RFC822.SIZE\s+(\d+).+/iA",$read_part, $reg)) {
534 if (preg_match("/^.+FLAGS\s+\((.*)\).+/iUA", $read_part, $regs)) {
535 $flags = explode(' ',trim($regs[1]));
536 foreach ($flags as $flag) {
537 $flag = strtolower($flag);
538 if ($flag == '\\seen') {
540 } else if ($flag == '\\answered') {
541 $flag_answered = true;
542 } else if ($flag == '\\deleted') {
543 $flag_deleted = true;
544 } else if ($flag == '\\flagged') {
545 $flag_flagged = true;
549 if (preg_match ("/^.+UID\s+(\d+).+/iA",$read_part, $reg)) {
550 $unique_id = $reg[1];
553 $firstchar = strtoupper($read_part{0});
554 if ($firstchar == 'T') {
555 $regpattern = $patterns[0];
557 } else if ($firstchar == 'F') {
558 $regpattern = $patterns[1];
560 } else if ($firstchar == 'X') {
561 $regpattern = $patterns[2];
563 } else if ($firstchar == 'C') {
564 if (strtolower($read_part{1}) == 'c') {
565 $regpattern = $patterns[3];
567 } else if (strtolower($read_part{1}) == 'o') {
568 $regpattern = $patterns[6];
571 } else if ($firstchar == 'D' && !$internaldate ) {
572 $regpattern = $patterns[4];
574 } else if ($firstchar == 'S') {
575 $regpattern = $patterns[5];
577 } else $regpattern = '';
580 if (preg_match ($regpattern, $read_part, $regs)) {
583 $to = trim($regs[1]);
586 $from = trim($regs[1]);
589 $priority = $regs[1];
592 $cc = trim($regs[1]);
598 $subject = trim($regs[1]);
599 if ($subject == "") {
600 $subject = _("(no subject)");
604 $type = strtolower(trim($regs[1]));
605 if ($pos = strpos($type, ";")) {
606 $type = substr($type, 0, $pos);
608 $type = explode("/", $type);
609 if(!is_array($type)) {
612 if (!isset($type[1])) {
626 $date = str_replace(' ', ' ', $date);
627 $tmpdate = explode(' ', trim($date));
629 $tmpdate = $date = array('', '', '', '', '', '');
632 $messages[$msgi]['ID'] = $unique_id;
634 $messages[$msgi]['ID'] = $msg_list[$msgi];
637 $messages[$msgi]['TIME_STAMP'] = getTimeStamp($tmpdate);
638 $messages[$msgi]['DATE_STRING'] = getDateString($messages[$msgi]['TIME_STAMP']);
639 $messages[$msgi]['FROM'] = parseAddress($from);
640 $messages[$msgi]['SUBJECT'] = $subject;
641 // if (handleAsSent($mailbox)) {
642 $messages[$msgi]['TO'] = parseAddress($to);
644 $messages[$msgi]['PRIORITY'] = $priority;
645 $messages[$msgi]['CC'] = parseAddress($cc);
646 $messages[$msgi]['SIZE'] = $size;
647 $messages[$msgi]['TYPE0'] = $type[0];
648 $messages[$msgi]['FLAG_DELETED'] = $flag_deleted;
649 $messages[$msgi]['FLAG_ANSWERED'] = $flag_answered;
650 $messages[$msgi]['FLAG_SEEN'] = $flag_seen;
651 $messages[$msgi]['FLAG_FLAGGED'] = $flag_flagged;
653 /* non server sort stuff */
654 if (!$allow_server_sort) {
655 $from = parseAddress($from);
657 $from = decodeHeader($from[0][1]);
661 $messages[$msgi]['FROM-SORT'] = $from;
662 $subject_sort = strtolower(decodeHeader($subject));
663 if (preg_match("/^(vedr|sv|re|aw):\s*(.*)$/si", $subject_sort, $matches)){
664 $messages[$msgi]['SUBJECT-SORT'] = $matches[2];
666 $messages[$msgi]['SUBJECT-SORT'] = $subject_sort;
674 function sqimap_get_headerfield($imap_stream, $field) {
675 $sid = sqimap_session_id(false);
678 $read_list = array();
680 $query = "$sid FETCH 1:* (UID BODY.PEEK[HEADER.FIELDS ($field)])\r\n";
681 fputs ($imap_stream, $query);
682 $readin_list = sqimap_read_data_list($imap_stream, $sid, false, $response, $message);
685 foreach ($readin_list as $r) {
687 /* first we unfold the header */
688 $r = str_replace(array("\r\n\t","\r\n\s"),array('',''),$r);
690 * now we can make a new header array with each element representing
693 $r = explode("\r\n" , $r);
695 if (!preg_match("/^\\*\s+([0-9]+)\s+FETCH/iAU",$r[0], $regs)) {
696 set_up_language($squirrelmail_language);
697 echo '<br><b><font color=$color[2]>' .
698 _("ERROR : Could not complete request.") .
700 _("Unknown response from IMAP server: ") . ' 1.' .
701 $r[0] . "</font><br>\n";
706 if (!preg_match("/^\\*\s+([0-9]+)\s+FETCH.*UID\s+([0-9]+)\s+/iAU",$r[0], $regs)) {
707 set_up_language($squirrelmail_language);
708 echo '<br><b><font color=$color[2]>' .
709 _("ERROR : Could not complete request.") .
711 _("Unknown response from IMAP server: ") . ' 1.' .
712 $r[0] . "</font><br>\n";
718 $field = substr($field,strlen($field)+
2);
719 $result[] = array($id,$field);
729 * Returns a message array with all the information about a message.
730 * See the documentation folder for more information about this array.
732 function sqimap_get_message ($imap_stream, $id, $mailbox) {
736 $read = sqimap_run_command ($imap_stream, "FETCH $id (FLAGS BODYSTRUCTURE)", true, $response, $message, $uid_support);
738 if (preg_match('/.+FLAGS\s\((.*)\)\s/AUi',$read[0],$regs)) {
739 if (trim($regs[1])) {
740 $flags = preg_split('/ /', $regs[1],-1,'PREG_SPLIT_NI_EMPTY');
744 echo "ERROR Yeah I know, not a very usefull errormessage (id = $id, mailbox = $mailbox sqimap_get_message)";
747 $bodystructure = implode('',$read);
748 $msg = mime_structure($bodystructure,$flags);
749 $read = sqimap_run_command ($imap_stream, "FETCH $id BODY[HEADER]", true, $response, $message, $uid_support);
750 $rfc822_header = new Rfc822Header();
751 $rfc822_header->parseHeader($read);
752 $msg->rfc822_header
= $rfc822_header;
756 /* Wrapper function that reformats the header information. */
757 function sqimap_get_message_header ($imap_stream, $id, $mailbox) {
759 $read = sqimap_run_command ($imap_stream, "FETCH $id BODY[HEADER]", true, $response, $message, $uid_support);
760 $header = sqimap_get_header($imap_stream, $read);
762 $header->mailbox
= $mailbox;
766 /* Wrapper function that reformats the entity header information. */
767 function sqimap_get_ent_header ($imap_stream, $id, $mailbox, $ent) {
769 $read = sqimap_run_command ($imap_stream, "FETCH $id BODY[$ent.HEADER]", true, $response, $message, $uid_support);
770 $header = sqimap_get_header($imap_stream, $read);
772 $header->mailbox
= $mailbox;
776 /* function to get the mime headers */
777 function sqimap_get_mime_ent_header ($imap_stream, $id, $mailbox, $ent) {
779 $read = sqimap_run_command ($imap_stream, "FETCH $id:$id BODY[$ent.MIME]", true, $response, $message, $uid_support);
780 $header = sqimap_get_header($imap_stream, $read);
782 $header->mailbox
= $mailbox;