| | |
| | | $_SESSION['compose']['references'] = trim($MESSAGE->headers->references . " " . $MESSAGE->headers->messageID); |
| | | |
| | | if (!empty($_SESSION['compose']['param']['all'])) |
| | | $MESSAGE->reply_all = 1; |
| | | $MESSAGE->reply_all = $_SESSION['compose']['param']['all']; |
| | | |
| | | $OUTPUT->set_env('compose_mode', 'reply'); |
| | | } |
| | |
| | | case 'reply-to': |
| | | $fname = '_replyto'; |
| | | $param = 'replyto'; |
| | | $header = 'reply-to'; |
| | | |
| | | case 'mailreplyto': |
| | | case 'mailreply-to': |
| | | if (!$fname) { |
| | | $fname = '_mailreplyto'; |
| | | $param = 'mailreplyto'; |
| | | $header = 'mailreply-to'; |
| | | } |
| | | |
| | | case 'mailfollowupto': |
| | | case 'mailfollowup-to': |
| | | if (!$fname) { |
| | | $fname = '_mailfollowupto'; |
| | | $param = 'mailfollowupto'; |
| | | $header = 'mailfollowup-to'; |
| | | } |
| | | |
| | | $allow_attrib = array('id', 'class', 'style', 'size', 'tabindex'); |
| | | $field_type = 'html_inputfield'; |
| | | break; |
| | |
| | | } |
| | | else if ($header && $compose_mode == RCUBE_COMPOSE_REPLY) { |
| | | // get recipent address(es) out of the message headers |
| | | if ($header=='to' && !empty($MESSAGE->headers->replyto)) |
| | | $fvalue = $MESSAGE->headers->replyto; |
| | | else if ($header=='to' && !empty($MESSAGE->headers->from)) |
| | | $fvalue = $MESSAGE->headers->from; |
| | | if ($header == 'to') { |
| | | $mailfollowup = $MESSAGE->headers->others['mail-followup-to']; |
| | | $mailreplyto = $MESSAGE->headers->others['mail-reply-to']; |
| | | |
| | | if ($MESSAGE->reply_all == 'list' && $mailfollowup) |
| | | $fvalue = $mailfollowup; |
| | | else if ($MESSAGE->reply_all == 'list' |
| | | && preg_match('/<mailto:([^>]+)>/i', $MESSAGE->headers->others['list-post'], $m)) |
| | | $fvalue = $m[1]; |
| | | else if ($mailreplyto) |
| | | $fvalue = $mailreplyto; |
| | | else if (!empty($MESSAGE->headers->replyto)) |
| | | $fvalue = $MESSAGE->headers->replyto; |
| | | else if (!empty($MESSAGE->headers->from)) |
| | | $fvalue = $MESSAGE->headers->from; |
| | | } |
| | | // add recipent of original message if reply to all |
| | | else if ($header=='cc' && !empty($MESSAGE->reply_all)) { |
| | | else if ($header == 'cc' && !empty($MESSAGE->reply_all) && $MESSAGE->reply_all != 'list') { |
| | | if ($v = $MESSAGE->headers->to) |
| | | $fvalue .= $v; |
| | | |
| | | if ($v = $MESSAGE->headers->cc) |
| | | $fvalue .= (!empty($fvalue) ? ', ' : '') . $v; |
| | | } |
| | |
| | | $fvalue = $MESSAGE->get_header('cc'); |
| | | else if ($header=='bcc' && !empty($MESSAGE->headers->bcc)) |
| | | $fvalue = $MESSAGE->get_header('bcc'); |
| | | else if ($header=='reply-to' && !empty($MESSAGE->headers->replyto)) |
| | | $fvalue = $MESSAGE->get_header('reply-to'); |
| | | else if ($header=='mail-reply-to' && !empty($MESSAGE->headers->others['mail-reply-to'])) |
| | | $fvalue = $MESSAGE->get_header('followup-to'); |
| | | else if ($header=='mail-followup-to' && !empty($MESSAGE->headers->others['mail-followup-to'])) |
| | | $fvalue = $MESSAGE->get_header('mail-followup-to'); |
| | | |
| | | $addresses = $IMAP->decode_address_list($fvalue); |
| | | $fvalue = ''; |
| | |
| | | foreach ($a_to as $addr) |
| | | { |
| | | if (!empty($addr['mailto'])) |
| | | $a_recipients[] = mb_strtolower(idn_to_utf8($addr['mailto'])); |
| | | $a_recipients[] = strtolower($addr['mailto']); |
| | | } |
| | | |
| | | if (!empty($MESSAGE->headers->cc)) |
| | |
| | | foreach ($a_cc as $addr) |
| | | { |
| | | if (!empty($addr['mailto'])) |
| | | $a_recipients[] = mb_strtolower(idn_to_utf8($addr['mailto'])); |
| | | $a_recipients[] = strtolower($addr['mailto']); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (count($user_identities)) |
| | | { |
| | | $from_id = 0; |
| | | $a_signatures = array(); |
| | | |
| | | $field_attrib['onchange'] = JS_OBJECT_NAME.".change_identity(this)"; |
| | | $select_from = new html_select($field_attrib); |
| | | |
| | | // create SELECT element |
| | | foreach ($user_identities as $sql_arr) |
| | | { |
| | | $sql_arr['email'] = mb_strtolower(idn_to_utf8($sql_arr['email'])); |
| | | $email = mb_strtolower(idn_to_utf8($sql_arr['email'])); |
| | | $identity_id = $sql_arr['identity_id']; |
| | | $select_from->add(format_email_recipient($sql_arr['email'], $sql_arr['name']), $identity_id); |
| | | $select_from->add(format_email_recipient($email, $sql_arr['name']), $identity_id); |
| | | |
| | | // add signature to array |
| | | if (!empty($sql_arr['signature']) && empty($_SESSION['compose']['param']['nosig'])) |
| | |
| | | } |
| | | |
| | | if ($compose_mode == RCUBE_COMPOSE_REPLY && is_array($MESSAGE->compose_from)) |
| | | $MESSAGE->compose_from[] = $sql_arr['email']; |
| | | |
| | | if (empty($_POST['_from']) && empty($_SESSION['compose']['param']['from'])) |
| | | { |
| | | // set draft's identity |
| | | if ($compose_mode == RCUBE_COMPOSE_DRAFT && strstr($MESSAGE->headers->from, $sql_arr['email'])) |
| | | $from_id = $sql_arr['identity_id']; |
| | | // set identity if it's one of the reply-message recipients (with prio for default identity) |
| | | else if (in_array($sql_arr['email'], $a_recipients) && (empty($from_id) || $sql_arr['standard'])) |
| | | $from_id = $sql_arr['identity_id']; |
| | | } |
| | | $MESSAGE->compose_from[] = $email; |
| | | } |
| | | |
| | | $from_id = 0; |
| | | |
| | | // overwrite identity selection with post parameter |
| | | if (!empty($_POST['_from'])) |
| | | $from_id = get_input_value('_from', RCUBE_INPUT_POST); |
| | | else if (!empty($_SESSION['compose']['param']['from'])) |
| | | $from_id = $_SESSION['compose']['param']['from']; |
| | | else { |
| | | $return_path = $MESSAGE->headers->others['return-path']; |
| | | |
| | | // Set identity |
| | | foreach ($user_identities as $sql_arr) { |
| | | // set draft's identity |
| | | if ($compose_mode == RCUBE_COMPOSE_DRAFT) { |
| | | if (strstr($MESSAGE->headers->from, $sql_arr['email'])) |
| | | $from_id = $sql_arr['identity_id']; |
| | | break; |
| | | } |
| | | // set identity if it's one of the reply-message recipients (with prio for default identity) |
| | | else if (in_array($sql_arr['email'], $a_recipients) && (empty($from_id) || $sql_arr['standard'])) |
| | | $from_id = $sql_arr['identity_id']; |
| | | // set identity when replying to mailing list |
| | | else if (strpos($return_path, str_replace('@', '=', $sql_arr['email']).'@') !== false) |
| | | $from_id = $sql_arr['identity_id']; |
| | | |
| | | if ($from_id) |
| | | break; |
| | | } |
| | | } |
| | | |
| | | $out = $select_from->show($from_id); |
| | | |
| | |
| | | { |
| | | global $RCMAIL, $MESSAGE, $LINE_LENGTH; |
| | | |
| | | // build reply prefix |
| | | $from = array_pop($RCMAIL->imap->decode_address_list($MESSAGE->get_header('from'))); |
| | | $prefix = sprintf("On %s, %s wrote:", |
| | | $MESSAGE->headers->date, $from['name'] ? $from['name'] : idn_to_utf8($from['email'])); |
| | | |
| | | if (!$bodyIsHtml) { |
| | | $body = preg_replace('/\r?\n/', "\n", $body); |
| | | |
| | | |
| | | // try to remove the signature |
| | | if ($RCMAIL->config->get('strip_existing_sig', true)) { |
| | | $len = strlen($body); |
| | |
| | | // soft-wrap and quote message text |
| | | $body = rcmail_wrap_and_quote(rtrim($body, "\n"), $LINE_LENGTH); |
| | | |
| | | // add title line(s) |
| | | $prefix = sprintf("On %s, %s wrote:\n", |
| | | $MESSAGE->headers->date, |
| | | $MESSAGE->get_header('from')); |
| | | |
| | | $prefix .= "\n"; |
| | | $suffix = ''; |
| | | |
| | | |
| | | if ($RCMAIL->config->get('top_posting')) |
| | | $prefix = "\n\n\n" . $prefix; |
| | | } |
| | |
| | | $body = rcmail_wash_html($body, array('safe' => $MESSAGE->is_safe), $cid_map); |
| | | |
| | | // build reply (quote content) |
| | | $prefix = sprintf("<p>On %s, %s wrote:</p>\n", |
| | | $MESSAGE->headers->date, |
| | | htmlspecialchars(Q($MESSAGE->get_header('from'), 'replace'), ENT_COMPAT, $RCMAIL->output->get_charset())); |
| | | $prefix = '<p>' . Q($prefix) . "</p>\n"; |
| | | $prefix .= '<blockquote>'; |
| | | |
| | | if ($RCMAIL->config->get('top_posting')) { |
| | |
| | | |
| | | function rcmail_receipt_checkbox($attrib) |
| | | { |
| | | global $MESSAGE, $compose_mode; |
| | | global $RCMAIL, $MESSAGE, $compose_mode; |
| | | |
| | | list($form_start, $form_end) = get_form_tags($attrib); |
| | | unset($attrib['form']); |
| | |
| | | $attrib['value'] = '1'; |
| | | $checkbox = new html_checkbox($attrib); |
| | | |
| | | if ($MESSAGE && in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT))) |
| | | $mdn_default = (bool) $MESSAGE->headers->mdn_to; |
| | | else |
| | | $mdn_default = $RCMAIL->config->get('mdn_default'); |
| | | |
| | | $out = $form_start ? "$form_start\n" : ''; |
| | | $out .= $checkbox->show(in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT)) |
| | | && $MESSAGE->headers->mdn_to ? 1 : 0); |
| | | $out .= $checkbox->show($mdn_default); |
| | | $out .= $form_end ? "\n$form_end" : ''; |
| | | |
| | | return $out; |