added To: field
[squirrelmail.git] / src / read_body.php
CommitLineData
be69e508 1<?
2 include("../config/config.php");
3 include("../functions/strings.php");
4 include("../functions/page_header.php");
5 include("../functions/imap.php");
6 include("../functions/mailbox.php");
7 include("../functions/date.php");
8
9 $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
10 selectMailbox($imapConnection, $mailbox, $numMessages);
11
12 echo "<HTML><BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">\n";
13 displayPageHeader($mailbox);
14 $body = fetchBody($imapConnection, $passed_id);
15 getMessageHeaders($imapConnection, $passed_id, $passed_id, $f, $s, $d);
2844086d 16 getMessageHeadersTo($imapConnection, $passed_id, $passed_id, $t);
be69e508 17
18 $subject = $s[0];
31f3d7c0 19 $url_subj = urlencode(trim($subject));
20
be69e508 21 $d[0] = ereg_replace(" ", " ", $d[0]);
be69e508 22 $date = $d[0];
23 $from_name = getSenderName($f[0]);
8467bf00 24 $urlMailbox = urlencode($mailbox);
be69e508 25
31f3d7c0 26 $url_from = trim(decodeEmailAddr($f[0]));
27 $url_from = urlencode($url_from);
28
2844086d 29 $to_left = trim($t[0]);
30 for ($i = 0; $to_left;$i++) {
31 if (strpos($to_left, ",")) {
32 $to_ary[$i] = trim(substr($to_left, 0, strpos($to_left, ",")));
33 $to_left = substr($to_left, strpos($to_left, ",")+1, strlen($to_left));
34 }
35 else {
36 $to_ary[$i] = trim($to_left);
37 $to_left = "";
38 }
39 }
40
41 $i = 0;
42 $to_string = "";
43 while ($i < count($to_ary)) {
44 if ($to_string)
45 $to_string = "$to_string<BR>$to_ary[$i]";
46 else
47 $to_string = "$to_ary[$i]";
48
49 $i++;
50 if (count($to_ary) > 1) {
51 if ($show_more == false) {
52 if ($i == 1) {
53 $to_string = "$to_string&nbsp;&nbsp;&nbsp;(<A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&sort=$sort&startMessage=$startMessage&show_more=1\">more</A>)";
54 $i = count($to_ary);
55 }
56 } else if ($i == 1) {
57 $to_string = "$to_string&nbsp;&nbsp;&nbsp;(<A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&sort=$sort&startMessage=$startMessage&show_more=0\">less</A>)";
58 }
59 }
60 }
61
8467bf00 62 echo "<BR>";
63 echo "<TABLE COLS=1 WIDTH=95% BORDER=0 ALIGN=CENTER CELLPADDING=2>\n";
64 echo " <TR><TD BGCOLOR=DCDCDC WIDTH=100%>";
31f3d7c0 65 echo " <TABLE WIDTH=100% BORDER=0 COLS=2>";
66 echo " <TR>";
67 echo " <TD ALIGN=LEFT WIDTH=50%>";
68 echo " <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
69 echo " <A HREF=\"right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">Message List</A>&nbsp;&nbsp;";
70 echo " <A HREF=\"delete_message.php?mailbox=$urlMailbox&message=$passed_id&sort=$sort&startMessage=1\">Delete</A>&nbsp;&nbsp;";
71 echo " </FONT>";
72 echo " </TD><TD WIDTH=50% ALIGN=RIGHT>";
73 echo " <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
74 echo " <A HREF=\"compose.php?forward_id=$passed_id&forward_subj=$url_subj&mailbox=$urlMailbox\">Forward</A>&nbsp;&nbsp;";
75 echo " <A HREF=\"compose.php?send_to=$url_from&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox\">Reply</A>&nbsp;&nbsp;";
76 echo " </FONT>";
77 echo " </TD>";
78 echo " </TR>";
79 echo " </TABLE>";
8467bf00 80 echo " </TD></TR>";
81 echo " <TR><TD BGCOLOR=FFFFFF WIDTH=100%>";
be69e508 82 echo " <TABLE COLS=2 WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>\n";
83 echo " <TR>\n";
84 /** subject **/
85 echo " <TD BGCOLOR=FFFFFF WIDTH=15% ALIGN=RIGHT>\n";
86 echo " <FONT FACE=\"Arial,Helvetica\">Subject:</FONT>\n";
87 echo " </TD><TD BGCOLOR=FFFFFF WIDTH=85%>\n";
88 echo " <FONT FACE=\"Arial,Helvetica\"><B>$subject</B></FONT>\n";
89 echo " </TD>\n";
90 echo " </TR>\n";
91 /** from **/
92 echo " <TR>\n";
93 echo " <TD BGCOLOR=FFFFFF WIDTH=15% ALIGN=RIGHT>\n";
94 echo " <FONT FACE=\"Arial,Helvetica\">From:</FONT>\n";
95 echo " </TD><TD BGCOLOR=FFFFFF WIDTH=85%>\n";
96 echo " <FONT FACE=\"Arial,Helvetica\"><B>$from_name</B></FONT>\n";
97 echo " </TD>\n";
98 echo " </TR>\n";
99 /** date **/
100 echo " <TR>\n";
101 echo " <TD BGCOLOR=FFFFFF WIDTH=15% ALIGN=RIGHT>\n";
102 echo " <FONT FACE=\"Arial,Helvetica\">Date:</FONT>\n";
103 echo " </TD><TD BGCOLOR=FFFFFF WIDTH=85%>\n";
104 echo " <FONT FACE=\"Arial,Helvetica\"><B>$date</B></FONT>\n";
105 echo " </TD>\n";
106 echo " </TR>\n";
2844086d 107 /** to **/
108 echo " <TR>\n";
109 echo " <TD BGCOLOR=FFFFFF WIDTH=15% ALIGN=RIGHT VALIGN=TOP>\n";
110 echo " <FONT FACE=\"Arial,Helvetica\">To:</FONT>\n";
111 echo " </TD><TD BGCOLOR=FFFFFF WIDTH=85% VALIGN=TOP>\n";
112 echo " <FONT FACE=\"Arial,Helvetica\"><B>$to_string</B></FONT>\n";
113 echo " </TD>\n";
114 echo " </TR>\n";
be69e508 115
116 echo " </TABLE></TD></TR>\n";
117
8467bf00 118 echo " <TR><TD BGCOLOR=FFFFFF WIDTH=100%><BR>\n";
e550d551 119 $i = 0;
120 while ($i < count($body)) {
121 echo "$body[$i]";
be69e508 122 $i++;
123 }
e550d551 124 echo " <BR></TD></TR>\n";
be69e508 125 echo " <TR><TD BGCOLOR=DCDCDC>&nbsp;</TD></TR>";
126 echo "</TABLE>\n";
127
128?>