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 $url_replytoall = urlencode($message["HEADER"]["REPLYTO"]);
29 $url_replytoallcc = urlencode(getLineOfAddrs($message["HEADER"]["TO"]) . ", " . getLineOfAddrs($message["HEADER"]["CC"]));
31 $dateString = getLongDateString($message["HEADER"]["DATE"]);
33 /** FORMAT THE TO STRING **/
36 $to_ary = $message["HEADER"]["TO"];
37 while ($i < count($to_ary)) {
38 $to_ary[$i] = htmlspecialchars($to_ary[$i]);
40 $to_string = "$to_string<BR>$to_ary[$i]";
42 $to_string = "$to_ary[$i]";
45 if (count($to_ary) > 1) {
46 if ($show_more == false) {
48 $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>)";
52 $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>)";
57 /** FORMAT THE CC STRING **/
60 $cc_ary = $message["HEADER"]["CC"];
61 while ($i < count($cc_ary)) {
62 $cc_ary[$i] = htmlspecialchars($cc_ary[$i]);
64 $cc_string = "$cc_string<BR>$cc_ary[$i]";
66 $cc_string = "$cc_ary[$i]";
69 if (count($cc_ary) > 1) {
70 if ($show_more_cc == false) {
72 $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>)";
76 $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>)";
81 /** make sure everything will display in HTML format **/
82 $from_name = htmlspecialchars($message["HEADER"]["FROM"]);
83 $subject = htmlspecialchars(stripslashes($message["HEADER"]["SUBJECT"]));
86 echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=98% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
87 echo " <TR><TD BGCOLOR=\"$color[0]\" WIDTH=100%>";
88 echo " <TABLE WIDTH=100% CELLSPACING=0 BORDER=0 COLS=2 CELLPADDING=3>";
90 echo " <TD ALIGN=LEFT WIDTH=50%>";
91 echo " <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
92 echo " <A HREF=\"right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">Message List</A> | ";
93 echo " <A HREF=\"delete_message.php?mailbox=$urlMailbox&message=$passed_id&sort=$sort&startMessage=1\">Delete</A> ";
95 echo " </TD><TD WIDTH=50% ALIGN=RIGHT>";
96 echo " <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
97 echo " <A HREF=\"compose.php?forward_id=$passed_id&forward_subj=$url_subj&mailbox=$urlMailbox\">Forward</A> | ";
98 echo " <A HREF=\"compose.php?send_to=$url_replyto&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox\">Reply</A> | ";
99 echo " <A HREF=\"compose.php?send_to=$url_replytoall&send_to_cc=$url_replytoallcc&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox\">Reply All</A> ";
105 echo " <TR><TD CELLSPACING=0 WIDTH=100%>";
106 echo " <TABLE COLS=2 WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=3>\n";
109 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
110 echo " <FONT FACE=\"Arial,Helvetica\">Subject:</FONT>\n";
111 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
112 echo " <FONT FACE=\"Arial,Helvetica\"><B>$subject</B></FONT>\n";
117 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
118 echo " <FONT FACE=\"Arial,Helvetica\">From:</FONT>\n";
119 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
120 echo " <FONT FACE=\"Arial,Helvetica\"><B>$from_name</B></FONT>\n";
125 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT>\n";
126 echo " <FONT FACE=\"Arial,Helvetica\">Date:</FONT>\n";
127 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85%>\n";
128 echo " <FONT FACE=\"Arial,Helvetica\"><B>$dateString</B></FONT>\n";
133 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT VALIGN=TOP>\n";
134 echo " <FONT FACE=\"Arial,Helvetica\">To:</FONT>\n";
135 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85% VALIGN=TOP>\n";
136 echo " <FONT FACE=\"Arial,Helvetica\"><B>$to_string</B></FONT>\n";
140 if ($message["HEADER"]["CC"][0]) {
142 echo " <TD BGCOLOR=\"$color[4]\" WIDTH=15% ALIGN=RIGHT VALIGN=TOP>\n";
143 echo " <FONT FACE=\"Arial,Helvetica\">Cc:</FONT>\n";
144 echo " </TD><TD BGCOLOR=\"$color[4]\" WIDTH=85% VALIGN=TOP>\n";
145 echo " <FONT FACE=\"Arial,Helvetica\"><B>$cc_string</B></FONT>\n";
152 echo " <TR><TD BGCOLOR=\"$color[4]\" WIDTH=100%>\n";
153 $body = formatBody($message, $color, $wrap_at);
158 echo " </TD></TR>\n";
159 echo " <TR><TD BGCOLOR=\"$color[9]\"> </TD></TR>";