- $body = decodeBody($body, $header->encoding);
- viewText($color, $body, $passed_id, $passed_ent_id, $mailbox, $type1, $wrap_at);
+ if ($type1 == "plain" || $type1 == "html") {
+ $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id);
+ $body = decodeBody($body, $header->encoding);
+ include("../functions/page_header.php");
+ viewText($color, $body, $passed_id, $passed_ent_id, $mailbox, $type1, $wrap_at);
+ } else {
+ $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id);
+ $body = decodeBody($body, $header->encoding);
+ header("Content-type: $type0/$type1; name=\"$filename\"");
+ header("Content-Disposition: inline; filename=\"$filename\"");
+ echo $body;
+ }