| | |
| | | $mailcc = rcmail_email_input_format(rcube_utils::get_input_value('_cc', rcube_utils::INPUT_POST, TRUE, $message_charset), true); |
| | | $mailbcc = rcmail_email_input_format(rcube_utils::get_input_value('_bcc', rcube_utils::INPUT_POST, TRUE, $message_charset), true); |
| | | |
| | | if ($EMAIL_FORMAT_ERROR) { |
| | | if ($EMAIL_FORMAT_ERROR && !$savedraft) { |
| | | $OUTPUT->show_message('emailformaterror', 'error', array('email' => $EMAIL_FORMAT_ERROR)); |
| | | $OUTPUT->send('iframe'); |
| | | } |
| | |
| | | $http_header .= $nldlm . ' via '; |
| | | } |
| | | |
| | | $host = $_SERVER['REMOTE_ADDR']; |
| | | $host = $_SERVER['REMOTE_ADDR']; |
| | | $hostname = gethostbyaddr($host); |
| | | |
| | | if ($encrypt) { |
| | |
| | | |
| | | $headers['Date'] = $RCMAIL->user_date(); |
| | | $headers['From'] = rcube_charset::convert($from_string, RCUBE_CHARSET, $message_charset); |
| | | $headers['To'] = $mailto; |
| | | $headers['To'] = $mailto; |
| | | |
| | | // additional recipients |
| | | if (!empty($mailcc)) { |
| | |
| | | } |
| | | } |
| | | |
| | | $dont_override = (array) $RCMAIL->config->get('dont_override'); |
| | | $mdn_enabled = in_array('mdn_default', $dont_override) ? $RCMAIL->config->get('mdn_default') : !empty($_POST['_mdn']); |
| | | $dsn_enabled = in_array('dsn_default', $dont_override) ? $RCMAIL->config->get('dsn_default') : !empty($_POST['_dsn']); |
| | | |
| | | // add subject |
| | | $headers['Subject'] = trim(rcube_utils::get_input_value('_subject', rcube_utils::INPUT_POST, TRUE, $message_charset)); |
| | | |
| | |
| | | $headers['Mail-Reply-To'] = $headers['Reply-To']; |
| | | } |
| | | if ($hdr = rcube_utils::get_input_value('_followupto', rcube_utils::INPUT_POST, TRUE, $message_charset)) { |
| | | $headers['Mail-Followup-To'] = rcmail_email_input_format(); |
| | | $headers['Mail-Followup-To'] = rcmail_email_input_format($hdr); |
| | | } |
| | | |
| | | // remember reply/forward UIDs in special headers |
| | |
| | | $headers['X-Draft-Info'] = array('type' => 'reply', 'uid' => $COMPOSE['reply_uid']); |
| | | } |
| | | else if (!empty($COMPOSE['forward_uid']) && $savedraft) { |
| | | $headers['X-Draft-Info'] = array('type' => 'forward', 'uid' => $COMPOSE['forward_uid']); |
| | | $headers['X-Draft-Info'] = array('type' => 'forward', 'uid' => rcube_imap_generic::compressMessageSet($COMPOSE['forward_uid'])); |
| | | } |
| | | |
| | | if (!empty($COMPOSE['reply_msgid'])) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (!empty($_POST['_receipt'])) { |
| | | if ($mdn_enabled) { |
| | | $headers['Return-Receipt-To'] = $from_string; |
| | | $headers['Disposition-Notification-To'] = $from_string; |
| | | } |
| | |
| | | } |
| | | |
| | | // append doctype and html/body wrappers |
| | | $message_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">' |
| | | . "\r\n<html><body" . (!empty($bstyle) ? " style='" . implode($bstyle, '; ') . "'" : '') . ">\r\n" |
| | | . $message_body; |
| | | $bstyle = !empty($bstyle) ? (" style='" . implode($bstyle, '; ') . "'") : ''; |
| | | $message_body = '<html><head>' |
| | | . '<meta http-equiv="Content-Type" content="text/html; charset=' . $message_charset . '" /></head>' |
| | | . "<body" . $bstyle . ">\r\n" . $message_body; |
| | | } |
| | | |
| | | if (!$savedraft) { |
| | | if ($isHtml) { |
| | | // remove signature's div ID |
| | | $message_body = preg_replace('/\s*id="_rc_sig"/', '', $message_body); |
| | | $b_style = 'padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0'; |
| | | $pre_style = 'margin: 0; padding: 0; font-family: monospace'; |
| | | |
| | | // add inline css for blockquotes |
| | | $bstyle = 'padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px'; |
| | | $message_body = preg_replace('/<blockquote>/', |
| | | '<blockquote type="cite" style="'.$bstyle.'">', $message_body); |
| | | $message_body = preg_replace( |
| | | array( |
| | | // remove signature's div ID |
| | | '/\s*id="_rc_sig"/', |
| | | // add inline css for blockquotes and container |
| | | '/<blockquote>/', |
| | | '/<div class="pre">/' |
| | | ), |
| | | array( |
| | | '', |
| | | '<blockquote type="cite" style="'.$b_style.'">', |
| | | '<div class="pre" style="'.$pre_style.'">' |
| | | ), |
| | | $message_body); |
| | | } |
| | | |
| | | // Check spelling before send |
| | |
| | | $COMPOSE['spell_checked'] = true; |
| | | |
| | | if (!$spell_result) { |
| | | $result = $isHtml ? $spellchecker->get_words() : $spellchecker->get_xml(); |
| | | if ($isHtml) { |
| | | $result['words'] = $spellchecker->get(); |
| | | $result['dictionary'] = (bool) $RCMAIL->config->get('spellcheck_dictionary'); |
| | | } |
| | | else { |
| | | $result = $spellchecker->get_xml(); |
| | | } |
| | | |
| | | $OUTPUT->show_message('mispellingsfound', 'error'); |
| | | $OUTPUT->command('spellcheck_resume', $isHtml, $result); |
| | | $OUTPUT->command('spellcheck_resume', $result); |
| | | $OUTPUT->send('iframe'); |
| | | } |
| | | } |
| | |
| | | $attachment = $RCMAIL->plugins->exec_hook('attachment_get', $attachment); |
| | | |
| | | if ($isHtml) { |
| | | $dispurl = '/\ssrc\s*=\s*[\'"]*\S+display-attachment\S+file=rcmfile' |
| | | . preg_quote($attachment['id']) . '[\s\'"]*/'; |
| | | $dispurl = '/[\'"]\S+display-attachment\S+file=rcmfile' . preg_quote($attachment['id']) . '[\'"]/'; |
| | | $message_body = $MAIL_MIME->getHTMLBody(); |
| | | $is_inline = preg_match($dispurl, $message_body); |
| | | } |
| | |
| | | $cid .= '@localhost'; |
| | | } |
| | | |
| | | $message_body = preg_replace($dispurl, ' src="cid:' . $cid . '" ', $message_body); |
| | | $message_body = preg_replace($dispurl, '"cid:' . $cid . '"', $message_body); |
| | | |
| | | $MAIL_MIME->setHTMLBody($message_body); |
| | | |
| | |
| | | $attachment['data'] ? false : true, |
| | | $ctype == 'message/rfc822' ? '8bit' : 'base64', |
| | | 'attachment', |
| | | '', '', '', |
| | | $attachment['charset'], |
| | | '', '', |
| | | $folding ? 'quoted-printable' : NULL, |
| | | $folding == 2 ? 'quoted-printable' : NULL, |
| | | '', RCUBE_CHARSET |
| | |
| | | $transfer_encoding = $RCMAIL->config->get('force_7bit') ? 'quoted-printable' : '8bit'; |
| | | } |
| | | else { |
| | | $text_charset = ''; |
| | | $text_charset = 'US-ASCII'; |
| | | $transfer_encoding = '7bit'; |
| | | } |
| | | |
| | | if ($flowed) { |
| | | if (!$text_charset) { |
| | | $text_charset = 'US-ASCII'; |
| | | } |
| | | |
| | | $text_charset .= ";\r\n format=flowed"; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // Handle Delivery Status Notification request |
| | | if (!empty($_POST['_dsn'])) { |
| | | $smtp_opts['dsn'] = true; |
| | | } |
| | | $smtp_opts['dsn'] = $dsn_enabled; |
| | | |
| | | $sent = $RCMAIL->deliver_message($MAIL_MIME, $from, $mailto, |
| | | $smtp_error, $mailbody_file, $smtp_opts); |
| | |
| | | } |
| | | |
| | | // set replied/forwarded flag |
| | | if ($COMPOSE['reply_uid']) |
| | | $RCMAIL->storage->set_flag($COMPOSE['reply_uid'], 'ANSWERED', $COMPOSE['mailbox']); |
| | | else if ($COMPOSE['forward_uid']) |
| | | $RCMAIL->storage->set_flag($COMPOSE['forward_uid'], 'FORWARDED', $COMPOSE['mailbox']); |
| | | if ($COMPOSE['reply_uid']) { |
| | | foreach (rcmail::get_uids($COMPOSE['reply_uid'], $COMPOSE['mailbox']) as $mbox => $uids) { |
| | | $RCMAIL->storage->set_flag($uids, 'ANSWERED', $mbox); |
| | | } |
| | | } |
| | | else if ($COMPOSE['forward_uid']) { |
| | | foreach (rcmail::get_uids($COMPOSE['forward_uid'], $COMPOSE['mailbox']) as $mbox => $uids) { |
| | | $RCMAIL->storage->set_flag($uids, 'FORWARDED', $mbox); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // Determine which folder to save message |
| | |
| | | $store_target = $drafts_mbox; |
| | | } |
| | | else if (!$RCMAIL->config->get('no_save_sent_messages')) { |
| | | $store_target = rcube_utils::get_input_value('_store_target', rcube_utils::INPUT_POST); |
| | | if (!strlen($store_target)) { |
| | | $sore_target = $RCMAIL->config->get('sent_mbox'); |
| | | if (isset($_POST['_store_target'])) { |
| | | $store_target = rcube_utils::get_input_value('_store_target', rcube_utils::INPUT_POST); |
| | | } |
| | | else { |
| | | $store_target = $RCMAIL->config->get('sent_mbox'); |
| | | } |
| | | } |
| | | |
| | |
| | | else { |
| | | $folders = array(); |
| | | |
| | | if ($COMPOSE['mode'] == 'reply' || $COMPOSE['mode'] == 'forward') { |
| | | if (in_array($COMPOSE['mode'], array('reply', 'forward', 'draft'))) { |
| | | $folders[] = $COMPOSE['mailbox']; |
| | | } |
| | | |
| | |
| | | if (!preg_match('/\.(php|ini|conf)$/', $file) && strpos($file, '/etc/') === false) { |
| | | $footer = file_get_contents($file); |
| | | if ($isHtml && !$html_footer) { |
| | | $footer = '<pre>' . $footer . '</pre>'; |
| | | $t2h = new rcube_text2html($footer, false); |
| | | $footer = $t2h->get_html(); |
| | | } |
| | | return $footer; |
| | | } |