2 include("../config/config.php");
3 include("../functions/strings.php");
4 include("../functions/page_header.php");
5 include("../functions/imap.php");
6 include("../functions/mime.php");
7 include("../functions/mailbox.php");
8 include("../functions/date.php");
10 include("../src/load_prefs.php");
12 $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
13 selectMailbox($imapConnection, $mailbox, $numMessages);
15 // $message contains all information about the message
16 // including header and body
17 $message = fetchMessage($imapConnection, $passed_id, $mailbox);
20 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
21 displayPageHeader($color, $mailbox);
23 /** translate the subject and mailbox into url-able text **/
24 $url_subj = urlencode(trim(stripslashes($message["HEADER"]["SUBJECT"])));
25 $urlMailbox = urlencode($mailbox);
26 $url_replyto = urlencode($message["HEADER"]["REPLYTO"]);
28 $dateString = getLongDateString($message["HEADER"]["DATE"]);
30 /** FORMAT THE TO STRING **/
33 $to_ary = $message["HEADER"]["TO"];
34 while ($i < count($to_ary)) {
35 $to_ary[$i] = htmlspecialchars($to_ary[$i]);
37 $to_string = "$to_string<BR>$to_ary[$i]";
39 $to_string = "$to_ary[$i]";
42 if (count($to_ary) > 1) {
43 if ($show_more == false) {
45 $to_string = "$to_string (<A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&sort=$sort&startMessage=$startMessage&show_more=1&show_more_cc=$show_more_cc\">more</A>)";
49 $to_string = "$to_string (<A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&sort=$sort&startMessage=$startMessage&show_more=0&show_more_cc=$show_more_cc\">less</A>)";
54 /** FORMAT THE CC STRING **/
57 $cc_ary = $message["HEADER"]["CC"];
58 while ($i < count($cc_ary)) {
59 $cc_ary[$i] = htmlspecialchars($cc_ary[$i]);
61 $cc_string = "$cc_string<BR>$cc_ary[$i]";
63 $cc_string = "$cc_ary[$i]";
66 if (count($cc_ary) > 1) {
67 if ($show_more_cc == false) {
69 $cc_string = "$cc_string (<A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&sort=$sort&startMessage=$startMessage&show_more_cc=1&show_more=$show_more\">more</A>)";
73 $cc_string = "$cc_string (<A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&sort=$sort&startMessage=$startMessage&show_more_cc=0&show_more=$show_more\">less</A>)";
78 /** make sure everything will display in HTML format **/
79 $from_name = htmlspecialchars($message["HEADER"]["FROM"]);
80 $subject = htmlspecialchars(stripslashes($message["HEADER"]["SUBJECT"]));
83 echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=98% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
84 echo " <TR><TD BGCOLOR=\"$color[0]\" WIDTH=100%>";
85 echo " <TABLE WIDTH=100% CELLSPACING=0 BORDER=0 COLS=2 CELLPADDING=3>";
87 echo " <TD ALIGN=LEFT WIDTH=50%>";
88 echo " <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
89 echo " <A HREF=\"right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">Message List</A> ";
90 echo " <A HREF=\"delete_message.php?mailbox=$urlMailbox&message=$passed_id&sort=$sort&startMessage=1\">Delete</A> ";
92 echo " </TD><TD WIDTH=50% ALIGN=RIGHT>";
93 echo " <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
94 echo " <A HREF=\"compose.php?forward_id=$passed_id&forward_subj=$url_subj&mailbox=$urlMailbox\">Forward</A> ";
95 echo " <A HREF=\"compose.php?send_to=$url_replyto&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox\">Reply</A> ";
101 echo " <TR><TD CELLSPACING=0 WIDTH=100%>";
102 echo " <TABLE COLS=2 WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=3>\n";
105 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
106 echo " <FONT FACE=\"Arial,Helvetica\">Subject:</FONT>\n";
107 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
108 echo " <FONT FACE=\"Arial,Helvetica\"><B>$subject</B></FONT>\n";
113 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
114 echo " <FONT FACE=\"Arial,Helvetica\">From:</FONT>\n";
115 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
116 echo " <FONT FACE=\"Arial,Helvetica\"><B>$from_name</B></FONT>\n";
121 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
122 echo " <FONT FACE=\"Arial,Helvetica\">Date:</FONT>\n";
123 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
124 echo " <FONT FACE=\"Arial,Helvetica\"><B>$dateString</B></FONT>\n";
129 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT VALIGN=TOP>\n";
130 echo " <FONT FACE=\"Arial,Helvetica\">To:</FONT>\n";
131 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85% VALIGN=TOP>\n";
132 echo " <FONT FACE=\"Arial,Helvetica\"><B>$to_string</B></FONT>\n";
136 if ($message["HEADER"]["CC"][0]) {
138 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT VALIGN=TOP>\n";
139 echo " <FONT FACE=\"Arial,Helvetica\">Cc:</FONT>\n";
140 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85% VALIGN=TOP>\n";
141 echo " <FONT FACE=\"Arial,Helvetica\"><B>$cc_string</B></FONT>\n";
148 echo " <TR><TD BGCOLOR=\"$color[4]\" WIDTH=100%>\n";
149 $body = formatBody($message, $color);
154 echo " </TD></TR>\n";
155 echo " <TR><TD BGCOLOR=\"$color[9]\"> </TD></TR>";