+ echo '<table class="button-menu">';
+ echo '<tr class="button-row">';
+ echo '<td class="button"><input class="btn-input" type="button" value="Return"
+ onclick="javascript: history.back();"/></td>';
+ echo '</tr></table>';
+
+ echo '<table>';
+ $from = $headers['from'];
+ $from = str_replace("<", "<", $from);
+ $from = str_replace(">", ">", $from);
+ echo "<tr><td class=\"label\">From</td><td class=\"value\">$from</td></tr>";
+ $to = $headers['to'];
+ $to = str_replace("<", "<", $to);
+ $to = str_replace(">", ">", $to);
+ echo "<tr><td class=\"label\">To</td><td class=\"value\">$to</td></tr>";
+ $date = $headers['date'];
+ $date = str_replace("<", "<", $date);
+ $date = str_replace(">", ">", $date);
+ echo "<tr><td class=\"label\">Date</td><td class=\"value\">$date</td></tr>";
+ echo "<tr><td class=\"label\">Subject</td><td class=\"value\">".$headers['subject']."</td></tr>";
+ echo '<tr><td class="label">Body</td><td class="value">';
+ if (isset($structure->parts)) {
+ foreach ($structure->parts as $part) {
+ if ($_GET['format'] == 'html') {
+ if ($part->ctype_primary=="text" and $part->ctype_secondary=="html") {
+ $bodytext = str_replace("\n", " ",$part->body);
+ $bodytext = str_replace("<body>", "", $bodytext);
+ $bodytext = str_replace("</body>", "", $bodytext);
+ $bodytext = str_replace("<head>", "", $bodytext);
+ $bodytext = str_replace("</head>", "", $bodytext);
+ $bodytext = str_replace("<html>", "", $bodytext);
+ $bodytext = str_replace("</html>", "", $bodytext);
+ echo $bodytext;
+ }
+ } else {
+ if ($part->ctype_primary=="text" and $part->ctype_secondary=="plain") {
+ $bodytext = str_replace("\n", "<br />",$part->body);
+ echo $bodytext;
+ }
+ }
+ }
+ } else {
+ if ($_GET['format'] == 'html') {
+ $bodytext = str_replace("\n", " ",$structure->body);
+ $bodytext = str_replace("<body>", "", $bodytext);
+ $bodytext = str_replace("</body>", "", $bodytext);
+ $bodytext = str_replace("<head>", "", $bodytext);
+ $bodytext = str_replace("</head>", "", $bodytext);
+
+ $bodytext = str_replace("<html>", "", $bodytext);
+ $bodytext = str_replace("</html>", "", $bodytext);
+ echo $bodytext;
+ } else {
+ $bodytext = $structure->body;
+ $bodytext = wordwrap($bodytext, 90, "<br/>");
+ echo $bodytext;
+ }
+ }
+ echo '</td></tr></table>';
+ echo $util->getFooter();