"; echo "
"; echo _("Viewing a plain text attachment"); echo "
"; echo "
"; $urlmailbox = urlencode($mailbox); echo "
"; echo _("Download this as a file"); echo "


"; if ($type1 == "html") echo $body; else echo translateText($body, $wrap_at); echo "
"; } $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); sqimap_mailbox_select($imapConnection, $mailbox); // $message contains all information about the message // including header and body $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); // lets redefine message as this particular entity that we wish to display. // it should hold only the header for this entity. We need to fetch the body // yet before we can display anything. $message = getEntity($message, $passed_ent_id); $header = $message->header; $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); $type0 = $header->type0; $type1 = $header->type1; $filename = $header->filename; if (strlen($filename) < 1) { $filename = "untitled$passed_ent_id"; } if ($absolute_dl == "true") { switch($type0) { case "text": $body = decodeBody($body, $header->encoding); header("Content-type: $type0/$type1; name=\"$filename\""); header("Content-Disposition: attachment; filename=\"$filename\""); echo trim($body); break; default: $body = decodeBody($body, $header->encoding); header("Content-type: $type0/$type1; name=\"$filename\""); header("Content-Disposition: attachment; filename=\"$filename\""); echo $body; break; } } else { switch ($type0) { case "text": $body = decodeBody($body, $header->encoding); viewText($color, $body, $passed_id, $passed_ent_id, $mailbox, $type1, $wrap_at); break; case "message": $body = decodeBody($body, $header->encoding); viewText($color, $body, $passed_id, $passed_ent_id, $mailbox, $type1, $wrap_at); break; default: $body = decodeBody($body, $header->encoding); header("Content-type: $type0/$type1; name=\"$filename\""); header("Content-Disposition: attachment; filename=\"$filename\""); echo $body; break; } } sqimap_logout($imapConnection); ?>