69b402b333182695bc0796b4502ace27a5d42d7e
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This file is used for reading the msgs array and displaying
10 * the resulting emails in the right frame.
15 require_once('../src/validate.php');
16 require_once('../functions/imap.php');
17 require_once('../functions/mime.php');
18 require_once('../functions/date.php');
19 require_once('../functions/url_parser.php');
20 require_once('../functions/smtp.php');
23 * Given an IMAP message id number, this will look it up in the cached
24 * and sorted msgs array and return the index. Used for finding the next
25 * and previous messages.
27 * returns the index of the next valid message from the array
29 function findNextMessage() {
30 global $msort, $currentArrayIndex, $msgs, $sort;
34 if ($currentArrayIndex != 1) {
35 $result = $currentArrayIndex - 1;
38 if (!is_array($msort)) {
41 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
42 if ($currentArrayIndex == $msgs[$key]['ID']) {
46 $result = $msgs[$key]['ID'];
54 /** Removes just one address from the list of addresses. */
55 function RemoveAddress(&$addr_list, $addr) {
57 foreach (array_keys($addr_list, $addr) as $key_to_delete) {
58 unset($addr_list[$key_to_delete]);
63 /** returns the index of the previous message from the array. */
64 function findPreviousMessage() {
65 global $msort, $currentArrayIndex, $sort, $msgs, $imapConnection,
66 $mailbox, $data_dir, $username;
71 $numMessages = sqimap_get_num_messages($imapConnection, $mailbox);
72 if ($currentArrayIndex != $numMessages) {
73 $result = $currentArrayIndex +
1;
76 if (!is_array($msort)) {
79 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
80 if ($currentArrayIndex == $msgs[$key]['ID']) {
84 $result = $msgs[$key]['ID'];
94 * Displays a link to a page where the message is displayed more
97 function printer_friendly_link() {
98 global $passed_id, $mailbox, $ent_num, $color,
102 if (strlen(trim($mailbox)) < 1) {
106 $params = '?passed_ent_id=' . $ent_num .
107 '&mailbox=' . urlencode($mailbox) .
108 '&passed_id=' . $passed_id;
110 $print_text = _("View Printable Version");
112 if (!$pf_subtle_link) {
113 /* The link is large, on the bottom of the header panel. */
114 $result = '<tr bgcolor="' . $color[0] . '">' .
115 '<td class="medText" align="right" valign="top">' .
117 '</td><td class="medText" valign="top" colspan="2">'."\n";
119 /* The link is subtle, below "view full header". */
123 /* Output the link. */
124 if ($javascript_on) {
125 $result .= '<script language="javascript" type="text/javascript">' . "\n" .
127 " function printFormat() {\n" .
128 ' window.open("../src/printer_friendly_main.php' .
129 $params . '","Print","width=800,height=600");' . "\n".
133 "<A HREF=\"javascript:printFormat();\">$print_text</A>\n";
135 $result .= '<A TARGET="_blank" HREF="../src/printer_friendly_bottom.php' .
136 "$params\">$print_text</A>\n";
139 if (!$pf_subtle_link) {
140 /* The link is large, on the bottom of the header panel. */
141 $result .= '</td></tr>' . "\n";
147 function ServerMDNSupport( $read ) {
148 /* escaping $ doesn't work -> \x36 */
149 $ret = preg_match( '/(\x36MDNSent|\\\*)/i', $read );
153 function SendMDN ( $recipient , $sender) {
154 global $imapConnection, $mailbox, $username, $attachment_dir, $SERVER_NAME,
155 $version, $attachments, $identity, $data_dir, $passed_id;
157 $header = sqimap_get_message_header($imapConnection, $passed_id, $mailbox);
158 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
162 $senton = getLongDateString( $header->date
);
163 $to_array = $header->to
;
165 foreach ($to_array as $line) {
169 $subject = $header->subject
;
170 $now = getLongDateString( time() );
172 $body = _("Your message") . "\r\n\r\n" .
173 "\t" . _("To:") . ' ' . $to . "\r\n" .
174 "\t" . _("Subject:") . ' ' . $subject . "\r\n" .
175 "\t" . _("Sent:") . ' ' . $senton . "\r\n" .
177 sprintf( _("Was displayed on %s"), $now );
181 $original_recipient = $to;
182 $original_message_id = $header->message_id
;
184 $part2 = "Reporting-UA : $SERVER_NAME ; SquirrelMail (version $version) \r\n";
185 if ($original_recipient != '') {
186 $part2 .= "Original-Recipient : $original_recipient\r\n";
188 $final_recipient = $sender;
189 $part2 .= "Final-Recipient: rfc822; $final_recipient\r\n" .
190 "Original-Message-ID : $original_message_id\r\n" .
191 "Disposition: manual-action/MDN-sent-manually; displayed\r\n";
194 $localfilename = GenerateRandomString(32, 'FILE', 7);
195 $full_localfilename = "$hashed_attachment_dir/$localfilename";
197 $fp = fopen( $full_localfilename, 'w');
198 fwrite ($fp, $part2);
201 $newAttachment = array();
202 $newAttachment['localfilename'] = $localfilename;
203 $newAttachment['type'] = "message/disposition-notification";
204 $newAttachment['session']=-1;
205 $attachments[] = $newAttachment;
206 $MDN_to = trim($recipient);
209 return (SendMessage($MDN_to,'','', _("Read:") . ' ' . $subject, $body,$reply_id, True, 3, -1) );
213 function ToggleMDNflag ( $set ) {
214 global $imapConnection, $passed_id, $mailbox;
215 sqimap_mailbox_select($imapConnection, $mailbox);
218 $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)';
219 $read = sqimap_run_command ($imapConnection, $cmd, true, $response,
223 function ClearAttachments() {
224 global $username, $attachments, $attachment_dir;
226 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
228 $rem_attachments = array();
229 foreach ($attachments as $info) {
230 if ($info->session
== -1) {
231 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
232 if (file_exists($attached_file)) {
233 unlink($attached_file);
236 $rem_attachments[] = $info;
239 $attachments = rem_attachments
;
242 function formatRecipientString($recipients, $item ) {
243 global $base_uri, $passed_id, $urlMailbox, $startMessage, $show_more_cc, $echo_more, $echo_less, $show_more, $show_more_bcc, $sort;
248 if (isset ($recipients[0]) && trim($recipients[0])) {
254 $show = "&show_more=1&show_more_cc=$show_more_cc&show_more_bcc=$show_more_bcc";
255 $show_n = "&show_more=0&show_more_cc=$show_more_cc&show_more_bcc=$show_more_bcc";
258 $show = "&show_more=$show_more&show_more_cc=1&show_more_bcc=$show_more_bcc";
259 $show_n = "&show_more=$show_more&show_more_cc=0&show_more_bcc=$show_more_bcc";
260 $show_more = $show_more_cc;
263 $show = "&show_more=$show_more&show_more_cc=$show_more_cc&show_more_bcc=1";
264 $show_n = "&show_more=$show_more&show_more_cc=$show_more_cc&show_more_bcc=0";
265 $show_more = $show_more_bcc;
271 while ($i < count($ary)) {
272 $ary[$i] = htmlspecialchars(decodeHeader($ary[$i]));
273 $url_string .= $ary[$i];
275 $string = "$string<BR>$ary[$i]";
277 $string = "$ary[$i]";
281 if (count($ary) > 1) {
282 if ($show_more == false) {
284 /* From a search... */
285 $string .= ' (<A HREF="' . $base_uri .
286 "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
287 if (isset($where) && isset($what)) {
288 $string .= 'what=' . urlencode($what)."&where=".urlencode($where)."$show\">$echo_more</A>)";
290 $string .= "sort=$sort&startMessage=$startMessage"."$show\">$echo_more</A>)";
294 } else if ($i == 1) {
295 /* From a search... */
296 $string .= ' (<A HREF="' . $base_uri .
297 "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
298 if (isset($where) && isset($what)) {
299 $string .= 'what=' . urlencode($what)."&where=".urlencode($where)."$show_n\">$echo_less</A>)";
301 $string .= "sort=$sort&startMessage=$startMessage"."$show_n\">$echo_less</A>)";
311 $url_string = urlencode($url_string);
313 $result['str'] = $string;
314 $result['url_str'] = $url_string;
321 * Main of read_boby.php --------------------------------------------------
330 if ( isset( $mailbox ) ) {
331 $mailbox = urldecode( $mailbox );
333 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
334 $read = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
339 * The following code sets necesarry stuff for the MDN thing
341 if( $default_use_mdn &&
342 ( $mdn_user_support = getPref($data_dir, $username, 'mdn_user_support', $default_use_mdn) ) ) {
344 $supportMDN = ServerMDNSupport($read["PERMANENTFLAGS"]);
345 $flags = sqimap_get_flags ($imapConnection, $passed_id);
346 $FirstTimeSee = !(in_array( 'Seen', $flags ));
349 displayPageHeader($color, $mailbox);
353 * The following code shows the header of the message and then exit
355 if (isset($view_hdr)) {
356 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[HEADER]", true, $a, $b);
359 '<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0" ALIGN="CENTER">' . "\n" .
360 " <TR><TD BGCOLOR=\"$color[9]\" WIDTH=\"100%\" ALIGN=\"CENTER\"><B>" . _("Viewing Full Header") . '</B> - '.
361 '<a href="' . $base_uri . "src/read_body.php?mailbox=".urlencode($mailbox);
362 if (isset($where) && isset($what)) {
363 // Got here from a search
364 echo "&passed_id=$passed_id&where=".urlencode($where)."&what=".urlencode($what).'">';
366 echo "&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more\">";
368 echo _("View message") . "</a></b></td></tr></table>\n" .
369 "<table width=\"99%\" cellpadding=2 cellspacing=0 border=0 align=center>\n" .
373 for ($i=1; $i < count($read); $i++
) {
374 $line = htmlspecialchars($read[$i]);
375 if (eregi("^>", $line)) {
377 $first[$i] = ' ';
379 } else if (eregi("^[ |\t]", $line)) {
382 } else if (eregi("^([^:]+):(.+)", $line, $regs)) {
383 $first[$i] = $regs[1] . ':';
384 $second[$i] = $regs[2];
387 $second[$i] = trim($line);
391 for ($i=0; $i < count($second); $i = $j) {
392 if (isset($first[$i])) {
395 if (isset($second[$i])) {
396 $s = nl2br($second[$i]);
399 while (($first[$j] == '') && ($j < count($first))) {
400 $s .= ' ' . nl2br($second[$j]);
405 echo "<nobr><tt><b>$f</b>$s</tt></nobr>";
408 echo "</td></tr></table>\n" .
410 sqimap_logout($imapConnection);
415 $currentArrayIndex = $passed_id;
417 $currentArrayIndex = -1;
420 for ($i = 0; $i < count($msgs); $i++
) {
421 if ($msgs[$i]['ID'] == $passed_id) {
422 $msgs[$i]['FLAG_SEEN'] = true;
426 // $message contains all information about the message
427 // including header and body
428 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
430 /** translate the subject and mailbox into url-able text **/
431 $url_subj = urlencode(trim($message->header
->subject
));
432 $urlMailbox = urlencode($mailbox);
434 if (isset($message->header
->replyto
)) {
435 $url_replyto = urlencode($message->header
->replyto
);
438 $url_replytoall = $url_replyto;
440 // If we are replying to all, then find all other addresses and
441 // add them to the list. Remove duplicates.
442 // This is somewhat messy, so I'll explain:
443 // 1) Take all addresses (from, to, cc) (avoid nasty join errors here)
444 $url_replytoall_extra_addrs = array_merge(
445 array($message->header
->from
),
446 $message->header
->to
,
450 // 2) Make one big string out of them
451 $url_replytoall_extra_addrs = join(';', $url_replytoall_extra_addrs);
453 // 3) Parse that into an array of addresses
454 $url_replytoall_extra_addrs = parseAddrs($url_replytoall_extra_addrs);
456 // 4) Make them unique -- weed out duplicates
457 // (Coded for PHP 4.0.0)
458 $url_replytoall_extra_addrs =
459 array_keys(array_flip($url_replytoall_extra_addrs));
461 // 5) Remove the addresses we'll be sending the message 'to'
462 $url_replytoall_avoid_addrs = '';
463 if (isset($message->header
->replyto
)) {
464 $url_replytoall_avoid_addrs = $message->header
->replyto
;
467 $url_replytoall_avoid_addrs = parseAddrs($url_replytoall_avoid_addrs);
468 foreach ($url_replytoall_avoid_addrs as $addr) {
469 RemoveAddress($url_replytoall_extra_addrs, $addr);
472 // 6) Remove our identities from the CC list (they still can be in the
473 // TO list) only if $include_self_reply_all is turned off
474 if (!$include_self_reply_all) {
475 RemoveAddress($url_replytoall_extra_addrs,
476 getPref($data_dir, $username, 'email_address'));
477 $idents = getPref($data_dir, $username, 'identities');
478 if ($idents != '' && $idents > 1) {
479 for ($i = 1; $i < $idents; $i ++
) {
480 $cur_email_address = getPref($data_dir, $username, 'email_address' . $i);
481 RemoveAddress($url_replytoall_extra_addrs, $cur_email_address);
486 // 7) Smoosh back into one nice line
487 $url_replytoallcc = getLineOfAddrs($url_replytoall_extra_addrs);
490 $url_replytoallcc = urlencode($url_replytoallcc);
492 $dateString = getLongDateString($message->header
->date
);
494 // What do we reply to -- text only, if possible
495 $ent_num = findDisplayEntity($message);
497 /** TEXT STRINGS DEFINITIONS **/
498 $echo_more = _("more");
499 $echo_less = _("less");
501 if (!isset($show_more_cc)) {
502 $show_more_cc = FALSE;
505 if (!isset($show_more_bcc)) {
506 $show_more_bcc = FALSE;
509 /** FORMAT THE TO STRING **/
510 $to = formatRecipientString($message->header
->to
, "to");
511 $to_string = $to['str'];
512 $url_to_string = $to['url_str'];
515 /** FORMAT THE CC STRING **/
517 $cc = formatRecipientString($message->header
->cc
, "cc");
518 $cc_string = $cc['str'];
519 $url_cc_string = $cc['url_str'];
521 /** FORMAT THE BCC STRING **/
523 $bcc = formatRecipientString($message->header
->bcc
, "bcc");
524 $bcc_string = $bcc['str'];
525 $url_bcc_string = $bcc['url_str'];
527 if ($default_use_priority) {
528 $priority_level = substr($message->header
->priority
,0,1);
530 switch($priority_level) {
531 /* check for a higher then normal priority. */
534 $priority_string = _("High");
537 /* check for a lower then normal priority. */
540 $priority_string = _("Low");
543 /* check for a normal priority. */
546 $priority_level = '3';
547 $priority_string = _("Normal");
553 /** make sure everything will display in HTML format **/
554 $from_name = decodeHeader(htmlspecialchars($message->header
->from
));
555 $subject = decodeHeader(htmlspecialchars($message->header
->subject
));
557 do_hook('read_body_top');
559 '<TABLE CELLSPACING="0" WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0">' .
560 '<TR><TD BGCOLOR="' . $color[9] . '" WIDTH="100%">' .
561 '<TABLE WIDTH="100%" CELLSPACING="0" BORDER="0" CELLPADDING="3">' .
563 '<TD ALIGN="LEFT" WIDTH="33%">' .
565 '<A HREF="' . $base_uri . 'src/';
567 if ($where && $what) {
571 echo "search.php?where$pos=".urlencode($where)."&pos=$pos&what$pos=".urlencode($what)."&mailbox=$urlMailbox\">";
573 echo "right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">";
575 echo _("Message List") .
576 '</A> | ' .
577 '<A HREF="' . $base_uri . "src/delete_message.php?mailbox=$urlMailbox&message=$passed_id&";
578 if ($where && $what) {
579 echo 'where=' . urlencode($where) . '&what=' . urlencode($what) . '">';
581 echo "sort=$sort&startMessage=$startMessage\">";
583 echo _("Delete") . '</A> ';
584 if (($mailbox == $draft_folder) && ($save_as_draft)) {
585 echo '| <A HREF="' . $base_uri .
586 "src/compose.php?mailbox=$mailbox&send_to=$url_to_string&send_to_cc=$url_cc_string&send_to_bcc=$url_bcc_string&subject=$url_subj&draft_id=$passed_id&ent_num=$ent_num" . '"';
587 if ($compose_new_win == '1') {
588 echo 'TARGET="compose_window" onClick="comp_in_new()"';
591 _("Resume Draft") . '</a>';
594 echo ' ' .
597 '<TD WIDTH="33%" ALIGN="CENTER">' .
600 if ( !($where && $what) ) {
602 if ($currentArrayIndex == -1) {
603 echo 'Previous | Next';
605 $prev = findPreviousMessage();
606 $next = findNextMessage();
609 echo '<a href="' . $base_uri . "src/read_body.php?passed_id=$prev&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Previous") . "</A> | ";
611 echo _("Previous") . ' | ';
615 echo '<a href="' . $base_uri . "src/read_body.php?passed_id=$next&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Next") . "</A>";
623 '</TD><TD WIDTH="33%" ALIGN="RIGHT">' .
625 '<A HREF="' . $base_uri . "src/compose.php?forward_id=$passed_id&forward_subj=$url_subj&".
626 ($default_use_priority?
"mailprio=$priority_level&":'')
627 ."mailbox=$urlMailbox&ent_num=$ent_num\"";
628 if ($compose_new_win == '1') {
629 echo 'TARGET="compose_window" onClick="comp_in_new()"';
633 '</A> | ' .
634 '<A HREF="' . $base_uri . "src/compose.php?send_to=$url_replyto&reply_subj=$url_subj&".
635 ($default_use_priority?
"mailprio=$priority_level&":'').
636 "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\"";
637 if ($compose_new_win == '1') {
638 echo 'TARGET="compose_window" onClick="comp_in_new()"';
642 '</A> | ' .
643 '<A HREF="' . $base_uri . "src/compose.php?send_to=$url_replytoall&send_to_cc=$url_replytoallcc&reply_subj=$url_subj&".
644 ($default_use_priority?
"mailprio=$priority_level&":'').
645 "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\"";
646 if ($compose_new_win == '1') {
647 echo 'TARGET="compose_window" onClick="comp_in_new()"';
657 '<TR><TD WIDTH="100%">' .
658 '<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="3">' . "\n" .
662 echo "<TD BGCOLOR=\"$color[0]\" WIDTH=\"10%\" ALIGN=\"right\" VALIGN=\"top\">\n" .
664 "</TD><TD BGCOLOR=\"$color[0]\" WIDTH=\"80%\" VALIGN=\"top\">\n" .
665 "<B>$subject</B> \n" .
667 '<TD ROWSPAN="4" width="10%" BGCOLOR="' . $color[0] .
668 '" ALIGN=right VALIGN=top NOWRAP><small>'.
669 '<A HREF="' . $base_uri . "src/read_body.php?mailbox=$urlMailbox&passed_id=$passed_id&";
671 /* From a search... */
672 if ($where && $what) {
673 echo 'where=' . urlencode($where) . '&what=' . urlencode($what) .
674 "&view_hdr=1\">" . _("View Full Header") . "</A>\n";
676 echo "startMessage=$startMessage&show_more=$show_more&view_hdr=1\">" .
677 _("View Full Header") . "</A>\n";
680 /* Output the printer friendly link if we are in subtle mode. */
681 if ($pf_subtle_link) {
682 echo printer_friendly_link(true);
685 do_hook("read_body_header_right");
686 echo '</small></TD>' .
691 '<TD BGCOLOR="' . $color[0] . '" ALIGN="RIGHT">' .
693 '</TD><TD BGCOLOR="' . $color[0] . '">' .
694 "<B>$from_name</B> \n" .
699 '<TD BGCOLOR="' . $color[0] . '" ALIGN="RIGHT">' . "\n" .
701 "</TD><TD BGCOLOR=\"$color[0]\">\n" .
702 "<B>$dateString</B> \n" .
708 "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
710 '</TD><TD BGCOLOR="' . $color[0] . '" VALIGN="TOP">' . "\n" .
711 "<B>$to_string</B> \n" .
715 if (isset($cc_string) && $cc_string <> '') {
717 "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
719 "</TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>" .
720 "<B>$cc_string</B> " .
726 if (isset($bcc_string) && $bcc_string <> '') {
728 "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
730 "</TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>" .
731 "<B>$bcc_string</B> " .
735 if ($default_use_priority && isset($priority_string) && $priority_string <> '' ) {
737 "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
738 _("Priority") . ': '.
739 "</TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>" .
740 "<B>$priority_string</B> " .
745 if ($show_xmailer_default) {
746 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY.PEEK[HEADER.FIELDS (X-Mailer User-Agent)]", true,
747 $response, $readmessage);
748 $mailer = substr($read[1], strpos($read[1], " "));
751 "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
753 "</TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>" .
754 "<B>$mailer</B> " .
760 /* Output the printer friendly link if we are not in subtle mode. */
761 if (!$pf_subtle_link) {
762 echo printer_friendly_link(true);
765 if ($default_use_mdn) {
766 if ($mdn_user_support) {
768 // debug gives you the capability to remove mdn-flags
769 // $MDNDebug = false;
770 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY.PEEK[HEADER.FIELDS (Disposition-Notification-To)]", true,
771 $response, $readmessage);
772 $MDN_to = substr($read[1], strpos($read[1], ' '));
773 $MDN_flag_present = false;
775 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id FLAGS", true,
776 $response, $readmessage);
778 $MDN_flag_present = preg_match( '/.*\$MDNSent/i', $read[0]);
781 (!isset( $sendreceipt ) ||
$sendreceipt == '' ) ) {
783 if ( $MDN_flag_present && $supportMDN) {
784 $sendreceipt = 'removeMDN';
785 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
790 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
791 _("Read receipt") . ': ' .
792 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
795 "</B> <a href=$url>[" . _("Remove MDN flag") . '] </a>' .
801 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
802 _("Read receipt") . ': ' .
803 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
804 '<B>'._("send").'</B>'.
811 } // when deleted or draft flag is set don't offer to send a MDN response
812 else if ( ereg('\\Draft',$read[0] ||
ereg('\\Deleted',$read[0])) ) {
814 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
815 _("Read receipt") . ': '.
816 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
817 '<B>' . _("requested") . "</B>" .
821 // if no MDNsupport don't use the annoying popup messages
822 else if ( !$FirstTimeSee ) {
823 $sendreceipt = 'send';
824 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
826 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
827 _("Read receipt") . ': ' .
828 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
829 '<B>' . _("requested") .
830 "</B> <a href=$url>[" . _("Send read receipt now") . "]</a>" .
836 $sendreceipt = 'send';
837 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
838 if ($javascript_on) {
839 echo "<script language=\"javascript\" type=\"text/javascript\"> \n" .
841 " if (window.confirm(\"" .
842 _("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?") .
844 " window.location=($url); \n" .
845 ' window.reload()' . "\n" .
851 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
852 _("Read receipt") . ': ' .
853 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
854 '<B>' . _("requested") . "  </B><a href=$url>" . '[' .
855 _("Send read receipt now") . '] </a>' ." \n" .
862 if ( !isset( $sendreceipt ) ||
$sendreceipt == '' ) {
863 } else if ( $sendreceipt == 'send' ) {
864 if ( !$MDN_flag_present) {
865 if (isset($identity) ) {
866 $final_recipient = getPref($data_dir, $username, 'email_address' . '0', '' );
868 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
871 $final_recipient = trim($final_recipient);
872 if ($final_recipient == '' ) {
873 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
876 if ( SendMDN( $MDN_to, $final_recipient ) > 0 && $supportMDN ) {
877 ToggleMDNflag( true);
880 $sendreceipt = 'removeMDN';
881 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
884 if ($MDNDebug && $supportMDN) {
886 " <TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>\n" .
887 " "._("Read receipt").": \n".
888 " </TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>\n" .
889 ' <B>'._("send").'</B>'." <a href=$url>" . '[' . _("Remove MDN flag") . '] </a>' . "\n" .
895 " <TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>\n" .
896 " "._("Read receipt").": \n".
897 " </TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>\n" .
898 ' <B>'._("send").'</B>'. "\n" .
905 elseif ($sendreceipt == 'removeMDN' ) {
906 ToggleMDNflag ( false );
908 $sendreceipt = 'send';
909 $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
911 "<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
912 _("Read receipt") . ': ' .
913 "</TD><TD BGCOLOR=\"$color[9]\" VALIGN=TOP colspan=2>" .
914 '<B>' . _("requested") .
915 "</B> <a href=$url>[" . _("Send read receipt now") . "]</a>" .
924 do_hook('read_body_header');
931 echo "<TABLE CELLSPACING=0 WIDTH=\"97%\" BORDER=0 ALIGN=CENTER CELLPADDING=0>\n" .
932 " <TR><TD BGCOLOR=\"$color[4]\" WIDTH=\"100%\">\n" .
934 formatBody($imapConnection, $message, $color, $wrap_at).
935 '</TD></TR></TABLE>' .
936 '<TABLE CELLSPACING="0" WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0">' . "\n" .
937 " <TR><TD BGCOLOR=\"$color[9]\"> </TD></TR>" .
940 /* show attached images inline -- if pref'fed so */
941 if (($attachment_common_show_images) &&
942 is_array($attachment_common_show_images_list)) {
944 foreach ($attachment_common_show_images_list as $img) {
945 $imgurl = '../src/download.php' .
947 'passed_id=' . urlencode($img['passed_id']) .
948 '&mailbox=' . urlencode($mailbox) .
949 '&passed_ent_id=' . urlencode($img['ent_id']) .
950 '&absolute_dl=true';
952 echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER>\n" .
955 "<img src=\"$imgurl\">\n" .
964 do_hook('read_body_bottom');
965 do_hook('html_bottom');
966 sqimap_logout($imapConnection);