fputs ($imap_stream, "a001 FETCH $id BODY[$ent_id]\r\n");
$topline = fgets ($imap_stream, 1024);
- $size = substr ($topline, strpos($topline, "{")+1);
- $size = substr ($size, 0, strpos($size, "}"));
- $read = fread ($imap_stream, $size);
- return $read;
+ if (ereg('\{([^\}]*)\}', $topline, $regs)) {
+ return fread ($imap_stream, $regs[1]);
+ }
+ else if (ereg('"([^"]*)"', $topline, $regs)) {
+ return $regs[1];
+ }
+ return "Body retrival error, please report this bug!\n\nTop line is \"$topline\"\n";
}
/* -[ END MIME DECODING ]----------------------------------------------------------- */
// If there are other types that shouldn't be formatted, add
// them here
- if ($message->header->type1 != "html") {
+ if ($body_message->header->type1 != "html") {
translateText($body, $wrap_at, $body_message->header->charset);
}
global $default_charset;
// Encode only if the string contains 8-bit characters or =?
- if (ereg("([\200-\377])|=\\?", $string)) {
+ if (ereg("([\200-\377]|=\\?)", $string)) {
$newstring = "=?$default_charset?Q?";
// First the special characters