| | |
| | | * Convert the given message part to proper HTML |
| | | * which can be displayed the message view |
| | | * |
| | | * @param object rcube_message_part Message part |
| | | * @param array Display parameters array |
| | | * @param rcube_message_part Message part |
| | | * @param array Display parameters array |
| | | * @return string Formatted HTML string |
| | | */ |
| | | function rcmail_print_body($part, $p = array()) |
| | |
| | | } |
| | | else { |
| | | // assert plaintext |
| | | $body = $part->body; |
| | | $body = $data['body']; |
| | | $part->ctype_secondary = $data['type'] = 'plain'; |
| | | } |
| | | |
| | |
| | | else if (!rcube_utils::mem_check($part->size * 10)) { |
| | | $out .= html::span('part-notice', $RCMAIL->gettext('messagetoobig'). ' ' |
| | | . html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part='.$part->mime_id |
| | | .'&_mbox='. urlencode($RCMAIL->storage->get_folder()), $RCMAIL->gettext('download'))); |
| | | .'&_mbox='. urlencode($MESSAGE->folder), $RCMAIL->gettext('download'))); |
| | | continue; |
| | | } |
| | | |
| | |
| | | // fetch part if not available |
| | | if (!isset($part->body)) { |
| | | $part->body = $MESSAGE->get_part_content($part->mime_id); |
| | | } |
| | | |
| | | // extract headers from message/rfc822 parts |
| | | if ($part->mimetype == 'message/rfc822') { |
| | | $msgpart = rcube_mime::parse_message($part->body); |
| | | if (!empty($msgpart->headers)) { |
| | | $part = $msgpart; |
| | | $out .= html::div('message-partheaders', rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : null, $part->headers)); |
| | | } |
| | | } |
| | | |
| | | // message is cached but not exists (#1485443), or other error |
| | |
| | | if (!rcube_utils::mem_check(strlen($MESSAGE->body) * 10)) { |
| | | $out .= html::span('part-notice', $RCMAIL->gettext('messagetoobig'). ' ' |
| | | . html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part=0' |
| | | .'&_mbox='. urlencode($RCMAIL->storage->get_folder()), $RCMAIL->gettext('download'))); |
| | | .'&_mbox='. urlencode($MESSAGE->folder), $RCMAIL->gettext('download'))); |
| | | } |
| | | else { |
| | | $plugin = $RCMAIL->plugins->exec_hook('message_body_prefix', |
| | |
| | | 'Message-ID' => $RCMAIL->gen_message_id(), |
| | | 'X-Sender' => $identity['email'], |
| | | 'References' => trim($message->headers->references . ' ' . $message->headers->messageID), |
| | | 'In-Reply-To' => $message->headers->messageID, |
| | | ); |
| | | |
| | | $report = "Final-Recipient: rfc822; {$identity['email']}\r\n" |
| | |
| | | $report .= "Reporting-UA: $agent\r\n"; |
| | | } |
| | | |
| | | $to = rcube_mime::decode_mime_string($message->headers->to, $message->headers->charset); |
| | | $date = $RCMAIL->format_date($message->headers->date, $RCMAIL->config->get('date_long')); |
| | | $body = $RCMAIL->gettext("yourmessage") . "\r\n\r\n" . |
| | | "\t" . $RCMAIL->gettext("to") . ': ' . rcube_mime::decode_mime_string($message->headers->to, $message->headers->charset) . "\r\n" . |
| | | "\t" . $RCMAIL->gettext("subject") . ': ' . $message->subject . "\r\n" . |
| | | "\t" . $RCMAIL->gettext("date") . ': ' . $RCMAIL->format_date($message->headers->date, $RCMAIL->config->get('date_long')) . "\r\n" . |
| | | "\t" . $RCMAIL->gettext("to") . ": {$to}\r\n" . |
| | | "\t" . $RCMAIL->gettext("subject") . ": {$message->subject}\r\n" . |
| | | "\t" . $RCMAIL->gettext("date") . ": {$date}\r\n" . |
| | | "\r\n" . $RCMAIL->gettext("receiptnote"); |
| | | |
| | | $compose->headers($headers); |
| | | $compose->headers(array_filter($headers)); |
| | | $compose->setContentType('multipart/report', array('report-type'=> 'disposition-notification')); |
| | | $compose->setTXTBody(rcube_mime::wordwrap($body, 75, "\r\n")); |
| | | $compose->addAttachment($report, 'message/disposition-notification', 'MDNPart2.txt', false, '7bit', 'inline'); |
| | | |
| | | if ($RCMAIL->config->get('mdn_use_from')) { |
| | | $options['mdn_use_from'] = true; |
| | | } |
| | | // SMTP options |
| | | $options = array('mdn_use_from' => (bool) $RCMAIL->config->get('mdn_use_from')); |
| | | |
| | | $sent = $RCMAIL->deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file, $options); |
| | | |