$send_to = decodeHeader($send_to);
$send_to_cc = decodeHeader($send_to_cc);
- if ($forward_id) {
- sqimap_mailbox_select($imapConnection, $mailbox);
- $msg = sqimap_get_message($imapConnection, $forward_id, $mailbox);
-
- if (containsType($msg, "text", "html", $ent_num)) {
- $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
- } else if (containsType($msg, "text", "plain", $ent_num)) {
- $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
- }
- // add other primary displaying msg types here
- else {
- // find any type that's displayable
- if (containsType($msg, "text", "any_type", $ent_num)) {
- $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
- } else if (containsType($msg, "msg", "any_type", $ent_num)) {
- $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
- } else {
- $body = _("No Message");
- }
- }
-
- $type1 = $msg["ENTITIES"][$ent_num]["TYPE1"];
-
- $tmp = _("-------- Original Message ---------\n");
- $body_ary = explode("\n", $body);
- $body = "";
- for ($i=0;$i < count($body_ary);$i++) {
- if ($type1 == "html")
- $tmp .= strip_tags($body_ary[$i]);
- else
- $tmp .= $body_ary[$i];
- $body = "$body$tmp\n";
- $tmp = "";
- }
- }
-
- if ($reply_id) {
+ if ($forward_id)
+ $id = $forward_id;
+ else if ($reply_id)
+ $id = $reply_id;
+
+ if ($id) {
sqimap_mailbox_select($imapConnection, $mailbox);
- $msg = sqimap_get_message($imapConnection, $reply_id, $mailbox);
-
- if (containsType($msg, "text", "html", $ent_num)) {
- $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
- } else if (containsType($msg, "text", "plain", $ent_num)) {
- $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
- }
- // add other primary displaying msg types here
- else {
- // find any type that's displayable
- if (containsType($msg, "text", "any_type", $ent_num)) {
- $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
- } else if (containsType($msg, "msg", "any_type", $ent_num)) {
- $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
- } else {
- $body = _("No Message");
- }
+ $message = sqimap_get_message($imapConnection, $id, $mailbox);
+ $message = getEntity($message, $ent_num);
+
+ if ($message->header->type0 == "text" || $message->header->type1 == "message") {
+ $body = decodeBody(mime_fetch_body($imapConnection, $id, $message->header->entity_id), $message->header->encoding);
+ } else {
+ $body = "";
}
- $type1 = $msg["ENTITIES"][$ent_num]["TYPE1"];
-
+ if ($forward_id)
+ $tmp = _("-------- Original Message ---------\n");
+ if ($message->header->type1 == "html")
+ $body = strip_tags($body);
+
$body_ary = explode("\n", $body);
$body = "";
- for ($i=0;$i < count($body_ary);$i++) {
- if ($type1 == "html")
- $tmp = strip_tags($body_ary[$i]);
+ for ($i=0; $i < count($body_ary); $i++) {
+ $tmp = $body_ary[$i];
+
+ if ($forward_id)
+ $body = "$body$tmp\n";
else
- $tmp = $body_ary[$i];
- $body = "$body> $tmp\n";
+ $body = "$body> $tmp\n";
}
+
}
-
+
if (!$send_to) {
$send_to = sqimap_find_email($send_to);
}
echo _("BCC:");
echo " </TD><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
if ($send_to_bcc)
- echo " <INPUT TYPE=TEXT NAME=\"send_to_bcc\" VALUE=\"$send_to_bcc\" SIZE=55><BR>\n";
+ echo " <INPUT TYPE=TEXT NAME=\"send_to_bcc\" VALUE=\"$send_to_bcc\" SIZE=60><BR>\n";
else
- echo " <INPUT TYPE=TEXT NAME=\"send_to_bcc\" SIZE=55><BR>";
- echo " </TD>\n";
- echo "<TD width=\"1%\" BGCOLOR=\"$color[4]\" ALIGN=Right>";
-
- if ($use_javascript_addr_book) {
- echo "<SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"";
- echo "<input type=button value=\\\""._("Addresses")."\\\" onclick='javascript:open_abook();'>\");";
- echo "// --></SCRIPT><NOSCRIPT>\n";
- echo "<input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
- echo "</NOSCRIPT>\n";
- } else {
- echo "<input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
- }
+ echo " <INPUT TYPE=TEXT NAME=\"send_to_bcc\" SIZE=60><BR>";
echo "</TD></TR>\n";
$reply_subj = trim($reply_subj);
if (substr(strtolower($reply_subj), 0, 3) != "re:")
$reply_subj = "Re: $reply_subj";
- echo " <INPUT TYPE=TEXT NAME=subject SIZE=55 VALUE=\"$reply_subj\">";
+ echo " <INPUT TYPE=TEXT NAME=subject SIZE=60 VALUE=\"$reply_subj\">";
} else if ($forward_subj) {
$forward_subj = str_replace("\"", "'", $forward_subj);
$forward_subj = stripslashes($forward_subj);
(substr(strtolower($forward_subj), 0, 5) != "[fwd:") &&
(substr(strtolower($forward_subj), 0, 6) != "[ fwd:"))
$forward_subj = "[Fwd: $forward_subj]";
- echo " <INPUT TYPE=TEXT NAME=subject SIZE=55 VALUE=\"$forward_subj\">";
+ echo " <INPUT TYPE=TEXT NAME=subject SIZE=60 VALUE=\"$forward_subj\">";
} else {
- echo " <INPUT TYPE=TEXT NAME=subject VALUE=\"$subject\" SIZE=55>";
+ echo " <INPUT TYPE=TEXT NAME=subject VALUE=\"$subject\" SIZE=60>";
}
- echo "</td><td align=right>";
- echo "<INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">";
- echo " </TD>\n";
- echo " </TR>\n";
+ echo "</td></tr>\n\n";
+
+ echo " <TR><td>\n </td><td>\n";
+ if ($use_javascript_addr_book) {
+ echo " <SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"";
+ echo " <input type=button value=\\\""._("Addresses")."\\\" onclick='javascript:open_abook();'>\");";
+ echo " // --></SCRIPT><NOSCRIPT>\n";
+ echo " <input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
+ echo " </NOSCRIPT>\n";
+ } else {
+ echo " <input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
+ }
+ echo "\n <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
+ echo " </TD>\n";
+ echo " </TR>\n\n";
+
echo " <TR>\n";
echo " <TD BGCOLOR=\"$color[4]\" COLSPAN=3>\n";