d77f5240abbbebbb50e181d73b0174f4164b6e1e
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 /* Path for SquirrelMail required files. */
16 define('SM_PATH','../');
18 /* SquirrelMail required files. */
19 require_once(SM_PATH
. 'include/validate.php');
20 require_once(SM_PATH
. 'functions/imap.php');
21 require_once(SM_PATH
. 'functions/mime.php');
22 require_once(SM_PATH
. 'functions/date.php');
23 require_once(SM_PATH
. 'functions/url_parser.php');
24 require_once(SM_PATH
. 'functions/html.php');
28 * Given an IMAP message id number, this will look it up in the cached
29 * and sorted msgs array and return the index. Used for finding the next
30 * and previous messages.
32 * @return the index of the next valid message from the array
34 function findNextMessage($passed_id) {
35 global $msort, $msgs, $sort,
36 $thread_sort_messages, $allow_server_sort,
38 if (!is_array($server_sort_array)) {
39 $thread_sort_messages = 0;
40 $allow_server_sort = FALSE;
43 if ($thread_sort_messages ||
$allow_server_sort) {
44 $count = count($server_sort_array) - 1;
45 foreach($server_sort_array as $key=>$value) {
46 if ($passed_id == $value) {
50 $result = $server_sort_array[$key +
1];
56 if ($passed_id != 1) {
57 $result = $passed_id - 1;
60 if (is_array($msort)) {
61 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
62 if ($passed_id == $msgs[$key]['ID']) {
66 $result = $msgs[$key]['ID'];
77 /** returns the index of the previous message from the array. */
78 function findPreviousMessage($numMessages, $passed_id) {
79 global $msort, $sort, $msgs,
80 $thread_sort_messages,
81 $allow_server_sort, $server_sort_array;
83 if (!is_array($server_sort_array)) {
84 $thread_sort_messages = 0;
85 $allow_server_sort = FALSE;
87 if ($thread_sort_messages ||
$allow_server_sort ) {
88 foreach($server_sort_array as $key=>$value) {
89 if ($passed_id == $value) {
93 $result = $server_sort_array[$key - 1];
99 if ($passed_id != $numMessages) {
100 $result = $passed_id +
1;
103 if (is_array($msort)) {
104 for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
105 if ($passed_id == $msgs[$key]['ID']) {
109 //echo $msort[$key]; /* Why again were we echoing here? */
110 $result = $msgs[$key]['ID'];
122 * Displays a link to a page where the message is displayed more
123 * "printer friendly".
125 function printer_friendly_link($mailbox, $passed_id, $passed_ent_id, $color) {
126 global $javascript_on;
128 $params = '?passed_ent_id=' . $passed_ent_id .
129 '&mailbox=' . urlencode($mailbox) .
130 '&passed_id=' . $passed_id;
132 $print_text = _("View Printable Version");
135 /* Output the link. */
136 if ($javascript_on) {
137 $result .= '<script language="javascript" type="text/javascript">' . "\n" .
139 " function printFormat() {\n" .
140 ' window.open("../src/printer_friendly_main.php' .
141 $params . '","Print","width=800,height=600");' . "\n".
145 "<a href=\"javascript:printFormat();\">$print_text</a>\n";
147 $result .= '<A target="_blank" HREF="../src/printer_friendly_bottom.php' .
148 "$params\">$print_text</a>\n";
153 function ServerMDNSupport($read) {
154 /* escaping $ doesn't work -> \x36 */
155 $ret = preg_match('/(\x36MDNSent|\\\*)/i', $read);
159 function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
160 global $username, $attachment_dir, $SERVER_NAME,
161 $version, $attachments, $squirrelmail_language, $default_charset,
162 $languages, $useSendmail, $domain, $sent_folder,
163 $popuser, $data_dir, $username;
165 $header = $message->rfc822_header
;
166 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
168 $rfc822_header = new Rfc822Header();
169 $content_type = new ContentType('multipart/report');
170 $content_type->properties
['report-type']='disposition-notification';
173 if ($default_charset) {
174 $content_type->properties
['charset']=$default_charset;
176 $rfc822_header->content_type
= $content_type;
177 $rfc822_header->to
[] = $header->dnt
;
178 $rfc822_header->subject
= _("Read:") . ' ' . $header->subject
;
182 if (isset($identity) && $identity != 'default') {
183 $from_mail = getPref($data_dir, $username,
184 'email_address' . $identity);
185 $full_name = getPref($data_dir, $username,
186 'full_name' . $identity);
187 $from_addr = '"'.$full_name.'" <'.$from_mail.'>';
188 $reply_to = getPref($data_dir, $username,
189 'reply_to' . $identity);
191 $from_mail = getPref($data_dir, $username, 'email_address');
192 $full_name = getPref($data_dir, $username, 'full_name');
193 $from_addr = '"'.$full_name.'" <'.$from_mail.'>';
194 $reply_to = getPref($data_dir, $username,'reply_to');
197 $from_addr = "$popuser@$domain";
198 $from_mail = $from_addr;
200 $rfc822_header->from
= $rfc822_header->parseAddress($from_addr,true);
202 $rfc822_header->reply_to
= $rfc822_header->parseAddress($reply_to,true);
206 $senton = getLongDateString( $header->date
);
207 $to_array = $header->to
;
209 foreach ($to_array as $line) {
210 $to .= ' '.$line->getAddress();
212 $now = getLongDateString( time() );
214 $body = _("Your message") . "\r\n\r\n" .
215 "\t" . _("To:") . ' ' . $to . "\r\n" .
216 "\t" . _("Subject:") . ' ' . $header->subject
. "\r\n" .
217 "\t" . _("Sent:") . ' ' . $senton . "\r\n" .
219 sprintf( _("Was displayed on %s"), $now );
221 $special_encoding = '';
222 if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
223 function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
224 $body = $languages[$squirrelmail_language]['XTRA_CODE']('encode', $body);
225 if (strtolower($default_charset) == 'iso-2022-jp') {
226 if (mb_detect_encoding($body) == 'ASCII') {
227 $special_encoding = '8bit';
229 $body = mb_convert_encoding($body, 'JIS');
230 $special_encoding = '7bit';
234 $part1 = new Message();
235 $part1->setBody($body);
236 $mime_header = new MessageHeader
;
237 $mime_header->type0
= 'text';
238 $mime_header->type1
= 'plain';
239 if ($special_encoding) {
240 $mime_header->encoding
= $special_encoding;
242 $mime_header->encoding
= 'us-ascii';
244 if ($default_charset) {
245 $mime_header->parameters
['charset'] = $default_charset;
247 $part1->mime_header
= $mime_header;
250 $original_recipient = $to;
251 $original_message_id = $header->message_id
;
253 $report = "Reporting-UA : $SERVER_NAME ; SquirrelMail (version $version) \r\n";
254 if ($original_recipient != '') {
255 $report .= "Original-Recipient : $original_recipient\r\n";
257 $final_recipient = $sender;
258 $report .= "Final-Recipient: rfc822; $final_recipient\r\n" .
259 "Original-Message-ID : $original_message_id\r\n" .
260 "Disposition: manual-action/MDN-sent-manually; displayed\r\n";
262 $part2 = new Message();
263 $part2->setBody($report);
264 $mime_header = new MessageHeader
;
265 $mime_header->type0
= 'message';
266 $mime_header->type1
= 'disposition-notification';
267 $mime_header->encoding
= 'us-ascii';
268 $part2->mime_header
= $mime_header;
270 $composeMessage = new Message();
271 $composeMessage->rfc822_header
= $rfc822_header;
272 $composeMessage->addEntity($part1);
273 $composeMessage->addEntity($part2);
277 require_once(SM_PATH
. 'class/deliver/Deliver_SendMail.class.php');
278 global $sendmail_path;
279 $deliver = new Deliver_SendMail();
280 $stream = $deliver->initStream($composeMessage,$sendmail_path);
282 require_once(SM_PATH
. 'class/deliver/Deliver_SMTP.class.php');
283 $deliver = new Deliver_SMTP();
284 global $smtpServerAddress, $smtpPort, $use_authenticated_smtp, $pop_before_smtp;
285 if ($use_authenticated_smtp) {
286 global $key, $onetimepad;
288 $pass = OneTimePadDecrypt($key, $onetimepad);
293 $authPop = (isset($pop_before_smtp) && $pop_before_smtp) ?
true : false;
294 $stream = $deliver->initStream($composeMessage,$domain,0,
295 $smtpServerAddress, $smtpPort, $authPop);
299 $length = $deliver->mail($composeMessage, $stream);
300 $success = $deliver->finalizeStream($stream);
303 $msg = $deliver->dlv_msg
. '<br>Server replied: '.$deliver->dlv_ret_nr
;
304 require_once(SM_PATH
. 'functions/display_messages.php');
305 plain_error_message($msg, $color);
308 if (sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
309 sqimap_append ($imapConnection, $sent_folder, $length);
310 require_once(SM_PATH
. 'class/deliver/Deliver_IMAP.class.php');
311 $imap_deliver = new Deliver_IMAP();
312 $imap_deliver->mail($composeMessage, $imapConnection);
313 sqimap_append_done ($imapConnection);
314 unset ($imap_deliver);
321 function ToggleMDNflag ($set ,$imapConnection, $mailbox, $passed_id, $uid_support) {
323 $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)';
324 $read = sqimap_run_command ($imapConnection, $cmd, true, $response,
325 $readmessage, $uid_support);
328 function ClearAttachments() {
329 global $username, $attachments, $attachment_dir;
331 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
333 $rem_attachments = array();
334 foreach ($attachments as $info) {
335 if ($info['session'] == -1) {
336 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
337 if (file_exists($attached_file)) {
338 unlink($attached_file);
341 $rem_attachments[] = $info;
344 $attachments = $rem_attachments;
347 function formatRecipientString($recipients, $item ) {
348 global $show_more_cc, $show_more, $show_more_bcc,
352 if ((is_array($recipients)) && (isset($recipients[0]))) {
358 $url = set_url_var($PHP_SELF, 'show_more',0);
360 $url = set_url_var($PHP_SELF, 'show_more',1);
362 } else if ($item == 'cc') {
365 $url = set_url_var($PHP_SELF, 'show_more_cc',0);
367 $url = set_url_var($PHP_SELF, 'show_more_cc',1);
369 } else if ($item == 'bcc') {
370 if ($show_more_bcc) {
372 $url = set_url_var($PHP_SELF, 'show_more_bcc',0);
374 $url = set_url_var($PHP_SELF, 'show_more_bcc',1);
378 $cnt = count($recipients);
379 foreach($recipients as $r) {
380 $add = htmlspecialchars($r->getAddress());
382 $string .= '<BR>' . $add;
386 $string .= ' (<A HREF="'.$url;
388 $string .= '">'._("less").'</A>)';
390 $string .= '">'._("more").'</A>)';
400 function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
401 $color, $FirstTimeSee) {
402 global $msn_user_support, $default_use_mdn, $draft_folder, $sent_folder,
403 $default_use_priority, $show_xmailer_default,
404 $mdn_user_support, $PHP_SELF, $javascript_on;
406 $header = $message->rfc822_header
;
408 $env[_("Subject")] = htmlspecialchars(decodeHeader($header->subject
));
409 $from_name = $header->getAddr_s('from');
411 $from_name = $header->getAddr_s('sender');
413 $from_name = _("Unknown sender");
416 $env[_("From")] = htmlspecialchars(decodeHeader($from_name));
417 $env[_("Date")] = getLongDateString($header->date
);
418 $env[_("To")] = formatRecipientString($header->to
, "to");
419 $env[_("Cc")] = formatRecipientString($header->cc
, "cc");
420 $env[_("Bcc")] = formatRecipientString($header->bcc
, "bcc");
421 if ($default_use_priority) {
422 $env[_("Priority")] = getPriorityStr($header->priority
);
424 if ($show_xmailer_default) {
425 $env[_("Mailer")] = decodeHeader($header->xmailer
);
427 if ($default_use_mdn) {
428 if ($mdn_user_support) {
430 if ($message->is_mdnsent
) {
431 $env[_("Read receipt")] = _("send");
433 $env[_("Read receipt")] = _("requested");
434 if (!($mailbox == $draft_folder ||
435 $mailbox == $sent_folder ||
436 $message->is_deleted ||
438 $mdn_url = $PHP_SELF . '&sendreceipt=1';
439 if ($FirstTimeSee && $javascript_on) {
440 $script = '<script language="JavaScript" type="text/javascript">' . "\n";
441 $script .= '<!--'. "\n";
442 $script .= 'if(window.confirm("' .
443 _("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?") .
447 $script .= '// -->'. "\n";
448 $script .= '</script>'. "\n";
451 $env[_("Read receipt")] .= ' <a href="' . $mdn_url . '">[' .
452 _("Send read receipt now") . ']</a>';
459 $s = '<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"';
460 $s .= ' ALIGN="center" BGCOLOR="' . $color[0] . '">';
461 foreach ($env as $key => $val) {
464 $s .= html_tag('TD', '<B>' . $key . ': </B>', 'RIGHT', '', 'VALIGN="TOP" WIDTH="20%"') . "\n";
465 $s .= html_tag('TD', $val, 'left', '', 'VALIGN="TOP" WIDTH="80%"') . "\n";
470 do_hook("read_body_header");
471 formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color);
475 function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response) {
476 global $base_uri, $sent_folder, $draft_folder, $where, $what, $color, $sort,
477 $startMessage, $compose_new_win, $PHP_SELF, $save_as_draft,
478 $enable_forward_as_attachment;
480 $topbar_delimiter = ' | ';
481 $urlMailbox = urlencode($mailbox);
482 $s = '<table width="100%" cellpadding="3" cellspacing="0" align="center"'.
483 ' border="0" bgcolor="'.$color[9].'"><tr><td align="left" width="33%"><small>';
485 $msgs_url = $base_uri . 'src/';
486 if (isset($where) && isset($what)) {
487 $msgs_url .= 'search.php?where=' . urlencode($where) .
488 '&what=' . urlencode($what) . '&mailbox=' . $urlMailbox;
489 $msgs_str = _("Search results");
491 $msgs_url .= 'right_main.php?sort=' . $sort . '&startMessage=' .
492 $startMessage . '&mailbox=' . $urlMailbox;
493 $msgs_str = _("Message List");
495 $s .= '<a href="' . $msgs_url . '">' . $msgs_str . '</a>';
496 $s .= $topbar_delimiter;
498 $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox .
499 '&message=' . $passed_id . '&';
500 if (!(isset($passed_ent_id) && $passed_ent_id)) {
501 if ($where && $what) {
502 $delete_url .= 'where=' . urlencode($where) . '&what=' . urlencode($what);
504 $delete_url .= 'sort=' . $sort . '&startMessage=' . $startMessage;
506 $s .= '<a href="' . $delete_url . '">' . _("Delete") . '</a>';
509 $comp_uri = $base_uri . 'src/compose.php' .
510 '?passed_id=' . $passed_id .
511 '&mailbox=' . $urlMailbox .
512 (isset($passed_ent_id)?
'&passed_ent_id='.$passed_ent_id:'');
514 if ($compose_new_win == '1') {
515 $link_open = '<a href="javascript:void(0)" onclick="comp_in_new(\'';
516 $link_close = '\')">';
518 $link_open = '<a href="';
521 if (($mailbox == $draft_folder) && ($save_as_draft)) {
522 $comp_alt_uri = $comp_uri . '&action=draft';
523 $comp_alt_string = _("Resume Draft");
524 } else if ($mailbox == $sent_folder) {
525 $comp_alt_uri = $comp_uri . '&action=edit_as_new';
526 $comp_alt_string = _("Edit Message as New");
528 if (isset($comp_alt_uri)) {
529 $s .= $topbar_delimiter;
530 $s .= $link_open . $comp_alt_uri . $link_close . $comp_alt_string . '</a>';
533 $s .= '</small></td><td align="center" width="33%"><small>';
535 if (!(isset($where) && isset($what)) && !$passed_ent_id) {
536 $prev = findPreviousMessage($mbx_response['EXISTS'], $passed_id);
537 $next = findNextMessage($passed_id);
539 $uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
540 '&mailbox='.$urlMailbox.'&sort='.$sort.
541 '&startMessage='.$startMessage.'&show_more=0';
542 $s .= '<a href="'.$uri.'">'._("Previous").'</a>';
546 $s .= $topbar_delimiter;
548 $uri = $base_uri . 'src/read_body.php?passed_id='.$next.
549 '&mailbox='.$urlMailbox.'&sort='.$sort.
550 '&startMessage='.$startMessage.'&show_more=0';
551 $s .= '<a href="'.$uri.'">'._("Next").'</a>';
555 } else if (isset($passed_ent_id) && $passed_ent_id) {
556 /* code for navigating through attached message/rfc822 messages */
557 $url = set_url_var($PHP_SELF, 'passed_ent_id',0);
558 $s .= '<a href="'.$url.'">'._("View Message").'</a>';
559 $par_ent_id = $message->parent
->entity_id
;
561 $par_ent_id = substr($par_ent_id,0,-2);
562 $s .= $topbar_delimiter;
563 $url = set_url_var($PHP_SELF, 'passed_ent_id',$par_ent_id);
564 $s .= '<a href="'.$url.'">'._("Up").'</a>';
568 $s .= '</small></td>' . "\n" . '<td align="right" width="33%" nowrap><small>';
569 $comp_action_uri = $comp_uri . '&action=forward';
570 $s .= $link_open . $comp_action_uri . $link_close . _("Forward") . '</a>';
571 $s .= $topbar_delimiter;
573 if ($enable_forward_as_attachment) {
574 $comp_action_uri = $comp_uri . '&action=forward_as_attachment';
575 $s .= $link_open . $comp_action_uri . $link_close . _("Forward as Attachment") . '</a>';
576 $s .= $topbar_delimiter;
579 $comp_action_uri = decodeHeader($comp_uri . '&action=reply');
580 $s .= $link_open . $comp_action_uri . $link_close . _("Reply") . '</a>';
581 $s .= $topbar_delimiter;
583 $comp_action_uri = $comp_uri . '&action=reply_all';
584 $s .= $link_open . $comp_action_uri . $link_close . _("Reply All") . '</a>';
585 $s .= '</small></td></tr></table>';
586 do_hook("read_body_menu_top");
588 do_hook("read_body_menu_bottom");
591 function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
592 global $QUERY_STRING, $base_uri;
594 $urlMailbox = urlencode($mailbox);
595 $url = $base_uri.'src/view_header.php?'.$QUERY_STRING;
598 '<TD VALIGN="MIDDLE" ALIGN="RIGHT" WIDTH="20%"><B>' . _("Options") . ": </B></TD>\n" .
599 '<TD VALIGN="MIDDLE" ALIGN="LEFT" WIDTH="80%"><SMALL>' .
600 '<a href="'.$url.'">'._("View Full Header").'</a>';
602 /* Output the printer friendly link if we are in subtle mode. */
603 $s .= ' | ' .
604 printer_friendly_link($mailbox, $passed_id, $passed_ent_id, $color);
606 do_hook("read_body_header_right");
607 $s = "</SMALL></TD>\n" .
613 /***************************/
614 /* Main of read_body.php */
615 /***************************/
623 global $uid_support, $sqimap_capabilities;
625 if (isset($mailbox)) {
626 $mailbox = urldecode( $mailbox );
629 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
630 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
632 if (!isset($messages)) {
634 sqsession_register($messages,'messages');
638 * $message contains all information about the message
639 * including header and body
642 $uidvalidity = $mbx_response['UIDVALIDITY'];
644 if (!isset($messages[$uidvalidity])) {
645 $messages[$uidvalidity] = array();
647 if (!isset($messages[$uidvalidity][$passed_id]) ||
!$uid_support) {
648 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
649 $FirstTimeSee = !$message->is_seen
;
650 $message->is_seen
= true;
651 $messages[$uidvalidity][$passed_id] = $message;
652 sqsession_register($messages, 'messages');
654 // $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
655 $message = $messages[$uidvalidity][$passed_id];
656 $FirstTimeSee = !$message->is_seen
;
658 //$FirstTimeSee = !$message->is_seen;
659 //$message->is_seen = true;
660 //$messages[$uidvalidity][$passed_id] = $message;
662 if (isset($passed_ent_id) && $passed_ent_id) {
663 $message = $message->getEntity($passed_ent_id);
664 if ($message->type0
!= 'message' && $message->type1
!= 'rfc822') {
665 $message = $message->parent
;
667 $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[$passed_ent_id.HEADER]", true, $response, $msg, $uid_support);
668 $rfc822_header = new Rfc822Header();
669 $rfc822_header->parseHeader($read);
670 $message->rfc822_header
= $rfc822_header;
674 $header = $message->header
;
678 /****************************************/
679 /* Block for handling incoming url vars */
680 /****************************************/
682 if (isset($sendreceipt)) {
683 if ( !$message->is_mdnsent
) {
684 if (isset($identity) ) {
685 $final_recipient = getPref($data_dir, $username, 'email_address' . '0', '' );
687 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
690 $final_recipient = trim($final_recipient);
691 if ($final_recipient == '' ) {
692 $final_recipient = getPref($data_dir, $username, 'email_address', '' );
694 $supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]);
695 if ( SendMDN( $mailbox, $passed_id, $final_recipient, $message, $imapConnection ) > 0 && $supportMDN ) {
696 ToggleMDNflag( true, $imapConnection, $mailbox, $passed_id, $uid_support);
697 $message->is_mdnsent
= true;
698 $messages[$uidvalidity][$passed_id]=$message;
703 /***********************************************/
704 /* End of block for handling incoming url vars */
705 /***********************************************/
707 $msgs[$passed_id]['FLAG_SEEN'] = true;
710 do_hook('read_body_top');
711 if ($show_html_default == 1) {
712 $ent_ar = $message->findDisplayEntity(array());
714 $ent_ar = $message->findDisplayEntity(array(), array('text/plain'));
716 $cnt = count($ent_ar);
717 for ($i = 0; $i < $cnt; $i++
) {
718 $messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox);
720 $messagebody .= '<hr noshade size=1>';
724 displayPageHeader($color, $mailbox);
725 formatMenuBar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response);
726 formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
727 echo '<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0">';
729 echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[9].'">';
731 echo ' <table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
732 echo ' <tr bgcolor="'.$color[4].'"><td>';
733 echo ' <table cellpadding="0" cellspacing="0" align="center" border="0">';
734 echo ' <tr><td><br>' . $messagebody . '</td></td>';
737 echo ' </table></td></tr>';
741 $attachmentsdisplay = formatAttachments($message,$ent_ar,$mailbox, $passed_id);
742 if ($attachmentsdisplay) {
744 echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">';
746 echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[4].'">';
747 echo ' <tr><td ALIGN="left" bgcolor="'.$color[9].'">';
748 echo ' <b>' . _("Attachments") . ':</b>';
751 echo ' <table width="100%" cellpadding="2" cellspacing="2" align="center"'.' border="0" bgcolor="'.$color[0].'"><tr><td>';
752 echo $attachmentsdisplay;
753 echo ' </td></tr></table>';
754 echo ' </table></td></tr>';
755 echo ' </table></td></tr>';
762 /* show attached images inline -- if pref'fed so */
763 if (($attachment_common_show_images) &&
764 is_array($attachment_common_show_images_list)) {
765 foreach ($attachment_common_show_images_list as $img) {
766 $imgurl = '../src/download.php' .
768 'passed_id=' . urlencode($img['passed_id']) .
769 '&mailbox=' . urlencode($mailbox) .
770 '&ent_id=' . urlencode($img['ent_id']) .
771 '&absolute_dl=true';
773 echo html_tag( 'table', "\n" .
774 html_tag( 'tr', "\n" .
775 html_tag( 'td', '<img src="' . $imgurl . '">' ."\n", 'left'
778 'center', '', 'cellspacing=0 border="0" cellpadding="2"');
782 do_hook('read_body_bottom');
783 do_hook('html_bottom');
784 //$message->clean_up();
785 sqimap_logout($imapConnection);