- $read = sqimap_read_data ($imap_stream, "a001", true, $a, $b);
- for ($i=1; $i < count($read)-1; $i++) {
- // This fixes a bug in UW. UW doesn't return what would normall be
- // expected from the BODY fetch command. It has an extra line at the
- // end. So if the second from the last line is a ), then remove it.
- if (trim($read[$i]) == ")" && $i == count($read)-2) {
- continue;
- }
- $text .= $read[$i];
- }
- return $text;
+ $topline = fgets ($imap_stream, 1024);
+ $size = substr ($topline, strpos($topline, "{")+1);
+ $size = substr ($size, 0, strpos($size, "}"));
+ $read = fread ($imap_stream, $size);
+ return $read;