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 include("../functions/mime.php");
10 include("../src/load_prefs.php");
12 echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
13 $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
14 displayPageHeader($color, "None");
17 selectMailbox($imapConnection, $mailbox, $numMessages);
18 $msg = fetchMessage($imapConnection, $forward_id, $mailbox);
20 if (containsType($msg, "text", "html", $ent_num)) {
21 $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
22 } else if (containsType($msg, "text", "plain", $ent_num)) {
23 $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
25 // add other primary displaying msg types here
27 // find any type that's displayable
28 if (containsType($msg, "text", "any_type", $ent_num)) {
29 $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
30 } else if (containsType($msg, "msg", "any_type", $ent_num)) {
31 $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
33 $body = _("No Message");
37 $type1 = $msg["ENTITIES"][$ent_num]["TYPE1"];
39 $tmp = _("-------- Original Message ---------\n");
40 $body_ary = explode("\n", $body);
42 for ($i=0;$i < count($body_ary);$i++
) {
44 $tmp .= strip_tags($body_ary[$i]);
46 $tmp .= $body_ary[$i];
47 $body = "$body$tmp\n";
53 selectMailbox($imapConnection, $mailbox, $numMessages);
54 $msg = fetchMessage($imapConnection, $reply_id, $mailbox);
56 if (containsType($msg, "text", "html", $ent_num)) {
57 $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
58 } else if (containsType($msg, "text", "plain", $ent_num)) {
59 $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
61 // add other primary displaying msg types here
63 // find any type that's displayable
64 if (containsType($msg, "text", "any_type", $ent_num)) {
65 $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
66 } else if (containsType($msg, "msg", "any_type", $ent_num)) {
67 $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
69 $body = _("No Message");
73 $type1 = $msg["ENTITIES"][$ent_num]["TYPE1"];
75 $body_ary = explode("\n", $body);
77 for ($i=0;$i < count($body_ary);$i++
) {
79 $tmp = strip_tags($body_ary[$i]);
82 $body = "$body> $tmp\n";
86 // Add some decoding information
87 $send_to = encodeEmailAddr($send_to);
88 // parses the field and returns only the email address
89 $send_to = decodeEmailAddr($send_to);
91 $send_to = strtolower($send_to);
92 $send_to = ereg_replace("\"", "", $send_to);
93 $send_to = stripslashes($send_to);
95 /** This formats a CC string if they hit "reply all" **/
96 if ($send_to_cc != "") {
97 $send_to_cc = ereg_replace(";", ",", $send_to_cc);
98 $sendcc = explode(",", $send_to_cc);
101 for ($i = 0; $i < count($sendcc); $i++
) {
102 $sendcc[$i] = trim($sendcc[$i]);
103 if ($sendcc[$i] == "")
106 $sendcc[$i] = encodeEmailAddr($sendcc[$i]);
107 $sendcc[$i] = decodeEmailAddr($sendcc[$i]);
109 $whofrom = encodeEmailAddr($msg["HEADER"]["FROM"]);
110 $whofrom = decodeEmailAddr($whofrom);
112 $whoreplyto = encodeEmailAddr($msg["HEADER"]["REPLYTO"]);
113 $whoreplyto = decodeEmailAddr($whoreplyto);
115 if ((strtolower(trim($sendcc[$i])) != strtolower(trim($whofrom))) &&
116 (strtolower(trim($sendcc[$i])) != strtolower(trim($whoreplyto))) &&
117 (trim($sendcc[$i]) != "")) {
118 $send_to_cc .= trim($sendcc[$i]) . ", ";
121 $send_to_cc = trim($send_to_cc);
122 if (substr($send_to_cc, -1) == ",") {
123 $send_to_cc = substr($send_to_cc, 0, strlen($send_to_cc) - 1);
127 echo "<FORM action=\"compose_send.php\" METHOD=POST>\n";
128 echo "<TABLE COLS=2 WIDTH=50 ALIGN=CENTER CELLSPACING=0 BORDER=0>\n";
130 echo " <TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
131 echo " <FONT FACE=\"Arial,Helvetica\">";
134 echo " </TD><TD WIDTH=% \"$color[4]\" ALIGN=LEFT>\n";
136 echo " <INPUT TYPE=TEXT NAME=passed_to VALUE=\"$send_to\" SIZE=60><BR>";
138 echo " <INPUT TYPE=TEXT NAME=passed_to SIZE=60><BR>";
142 echo " <TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
143 echo " <FONT FACE=\"Arial,Helvetica\">CC:</FONT>\n";
144 echo " </TD><TD WIDTH=% BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
146 echo " <INPUT TYPE=TEXT NAME=passed_cc SIZE=60 VALUE=\"$send_to_cc\"><BR>";
148 echo " <INPUT TYPE=TEXT NAME=passed_cc SIZE=60><BR>";
152 echo " <TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
153 echo " <FONT FACE=\"Arial,Helvetica\">BCC:</FONT>\n";
154 echo " </TD><TD WIDTH=% BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
155 echo " <INPUT TYPE=TEXT NAME=passed_bcc SIZE=60><BR>";
159 echo " <TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
160 echo " <FONT FACE=\"Arial,Helvetica\">";
163 echo " </TD><TD WIDTH=% BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
165 $reply_subj = str_replace("\"", "'", $reply_subj);
166 $reply_subj = stripslashes($reply_subj);
167 $reply_subj = trim($reply_subj);
168 if (substr(strtolower($reply_subj), 0, 3) != "re:")
169 $reply_subj = "Re: $reply_subj";
170 echo " <INPUT TYPE=TEXT NAME=passed_subject SIZE=60 VALUE=\"$reply_subj\">";
171 } else if ($forward_subj) {
172 $forward_subj = str_replace("\"", "'", $forward_subj);
173 $forward_subj = stripslashes($forward_subj);
174 $forward_subj = trim($forward_subj);
175 if ((substr(strtolower($forward_subj), 0, 4) != "fwd:") &&
176 (substr(strtolower($forward_subj), 0, 5) != "[fwd:") &&
177 (substr(strtolower($forward_subj), 0, 6) != "[ fwd:"))
178 $forward_subj = "[Fwd: $forward_subj]";
179 echo " <INPUT TYPE=TEXT NAME=passed_subject SIZE=60 VALUE=\"$forward_subj\">";
181 echo " <INPUT TYPE=TEXT NAME=passed_subject SIZE=60>";
183 echo " <INPUT TYPE=SUBMIT VALUE=\"";
189 echo " <TD BGCOLOR=\"$color[4]\" COLSPAN=2>\n";
190 if ($use_signature == true)
191 echo " <TEXTAREA NAME=passed_body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>$body\n\n$signature</TEXTAREA><BR>";
193 echo " <TEXTAREA NAME=passed_body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>$body</TEXTAREA><BR>";
197 echo "<CENTER><INPUT TYPE=SUBMIT VALUE=\"";