summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/compose.inc22
-rw-r--r--program/steps/mail/copy.inc4
-rw-r--r--program/steps/mail/folders.inc84
-rw-r--r--program/steps/mail/func.inc93
-rw-r--r--program/steps/mail/getunread.inc13
-rw-r--r--program/steps/mail/list.inc3
-rw-r--r--program/steps/mail/mark.inc6
-rw-r--r--program/steps/mail/move_del.inc10
-rw-r--r--program/steps/mail/search.inc3
-rw-r--r--program/steps/mail/sendmail.inc69
-rw-r--r--program/steps/mail/show.inc7
11 files changed, 146 insertions, 168 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 828a94f3b..45b95c937 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -267,19 +267,11 @@ function rcmail_compose_headers($attrib)
$param = 'replyto';
$header = 'reply-to';
- case 'mailreplyto':
- case 'mail-reply-to':
+ case 'followupto':
+ case 'followup-to':
if (!$fname) {
- $fname = '_mailreplyto';
- $param = 'mailreplyto';
- $header = 'mail-reply-to';
- }
-
- case 'mailfollowupto':
- case 'mail-followup-to':
- if (!$fname) {
- $fname = '_mailfollowupto';
- $param = 'mailfollowupto';
+ $fname = '_followupto';
+ $param = 'followupto';
$header = 'mail-followup-to';
}
@@ -354,10 +346,10 @@ function rcmail_compose_headers($attrib)
$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->others['mail-reply-to']))
+ $fvalue = $MESSAGE->get_header('mail-reply-to');
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');
@@ -742,7 +734,7 @@ function rcmail_create_reply_body($body, $bodyIsHtml)
// 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']));
+ $MESSAGE->headers->date, $from['name'] ? $from['name'] : idn_to_utf8($from['mailto']));
if (!$bodyIsHtml) {
$body = preg_replace('/\r?\n/', "\n", $body);
diff --git a/program/steps/mail/copy.inc b/program/steps/mail/copy.inc
index 4cd51d816..8a7c5916b 100644
--- a/program/steps/mail/copy.inc
+++ b/program/steps/mail/copy.inc
@@ -33,7 +33,7 @@ if (!empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) {
if (!$copied) {
// send error message
- $OUTPUT->show_message('errorcopying', 'error');
+ rcmail_display_server_error('errorcopying');
$OUTPUT->send();
exit;
}
@@ -52,5 +52,3 @@ else {
// send response
$OUTPUT->send();
-
-
diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc
index 26f464b0c..3b96dc29c 100644
--- a/program/steps/mail/folders.inc
+++ b/program/steps/mail/folders.inc
@@ -20,55 +20,61 @@
// only process ajax requests
if (!$OUTPUT->ajax_call)
- return;
+ return;
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true);
// send EXPUNGE command
-if ($RCMAIL->action=='expunge')
-{
- $success = $IMAP->expunge($mbox);
+if ($RCMAIL->action == 'expunge') {
- // reload message list if current mailbox
- if ($success && !empty($_REQUEST['_reload']))
- {
- $OUTPUT->command('set_quota', rcmail_quota_content());
- $OUTPUT->command('message_list.clear');
- $RCMAIL->action = 'list';
- return;
- }
- else
- $commands = "// expunged: $success\n";
+ $success = $IMAP->expunge($mbox);
+
+ // reload message list if current mailbox
+ if ($success) {
+ $OUTPUT->show_message('folderexpunged', 'confirmation');
+
+ if (!empty($_REQUEST['_reload'])) {
+ $OUTPUT->command('set_quota', rcmail_quota_content());
+ $OUTPUT->command('message_list.clear');
+ $RCMAIL->action = 'list';
+ return;
+ }
+ }
+ else {
+ rcmail_display_server_error();
+ }
}
// clear mailbox
-else if ($RCMAIL->action=='purge')
+else if ($RCMAIL->action == 'purge')
{
- $delimiter = $IMAP->get_hierarchy_delimiter();
- $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/';
- $junk_regexp = '/^' . preg_quote($CONFIG['junk_mbox'] . $delimiter, '/') . '/';
+ $delimiter = $IMAP->get_hierarchy_delimiter();
+ $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/';
+ $junk_regexp = '/^' . preg_quote($CONFIG['junk_mbox'] . $delimiter, '/') . '/';
- // we should only be purging trash and junk (or their subfolders)
- if ($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']
- || preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox))
- {
- $success = $IMAP->clear_mailbox($mbox);
-
- if ($success && !empty($_REQUEST['_reload']))
- {
- $OUTPUT->set_env('messagecount', 0);
- $OUTPUT->set_env('pagecount', 0);
- $OUTPUT->command('message_list.clear');
- $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text());
- $OUTPUT->command('set_unread_count', $mbox, 0);
- $OUTPUT->command('set_quota', rcmail_quota_content());
- $_SESSION['unseen_count'][$mbox] = 0;
- }
- else
- $commands = "// purged: $success";
- }
-}
+ // we should only be purging trash and junk (or their subfolders)
+ if ($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']
+ || preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox)
+ ) {
+ $success = $IMAP->clear_mailbox($mbox);
-$OUTPUT->send($commands);
+ if ($success) {
+ $OUTPUT->show_message('folderpurged', 'confirmation');
+ if (!empty($_REQUEST['_reload'])) {
+ $OUTPUT->set_env('messagecount', 0);
+ $OUTPUT->set_env('pagecount', 0);
+ $OUTPUT->command('message_list.clear');
+ $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text());
+ $OUTPUT->command('set_unread_count', $mbox, 0);
+ $OUTPUT->command('set_quota', rcmail_quota_content());
+ rcmail_set_unseen_count($mbox, 0);
+ }
+ }
+ else {
+ rcmail_display_server_error();
+ }
+ }
+}
+$OUTPUT->send();
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index c7498d5b1..750cf6f61 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -436,65 +436,6 @@ function rcmail_messagecount_display($attrib)
}
-function rcmail_quota_display($attrib)
- {
- global $OUTPUT;
-
- if (!$attrib['id'])
- $attrib['id'] = 'rcmquotadisplay';
-
- if(isset($attrib['display']))
- $_SESSION['quota_display'] = $attrib['display'];
-
- $OUTPUT->add_gui_object('quotadisplay', $attrib['id']);
-
- $quota = rcmail_quota_content($attrib);
-
- $OUTPUT->add_script('$(document).ready(function(){
- rcmail.set_quota('.json_serialize($quota).')});', 'foot');
-
- return html::span($attrib, '');
- }
-
-
-function rcmail_quota_content($attrib=NULL)
- {
- global $COMM_PATH, $RCMAIL;
-
- $quota = $RCMAIL->imap->get_quota();
- $quota = $RCMAIL->plugins->exec_hook('quota', $quota);
-
- $quota_result = (array) $quota;
- $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
-
- if (!$quota['total'] && $RCMAIL->config->get('quota_zero_as_unlimited')) {
- $quota_result['title'] = rcube_label('unlimited');
- $quota_result['percent'] = 0;
- }
- else if ($quota['total']) {
- if (!isset($quota['percent']))
- $quota_result['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100));
-
- $title = sprintf('%s / %s (%.0f%%)',
- show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024),
- $quota_result['percent']);
-
- $quota_result['title'] = $title;
-
- if ($attrib['width'])
- $quota_result['width'] = $attrib['width'];
- if ($attrib['height'])
- $quota_result['height'] = $attrib['height'];
- }
- else {
- $quota_result['title'] = rcube_label('unknown');
- $quota_result['percent'] = 0;
- }
-
- return $quota_result;
- }
-
-
function rcmail_get_messagecount_text($count=NULL, $page=NULL)
{
global $RCMAIL, $IMAP;
@@ -545,7 +486,7 @@ function rcmail_send_unread_count($mbox_name, $force=false, $count=null)
{
global $RCMAIL;
- $old_unseen = $_SESSION['unseen_count'][$mbox_name];
+ $old_unseen = rcmail_get_unseen_count($mbox_name);
if ($count === null)
$unseen = $RCMAIL->imap->messagecount($mbox_name, 'UNSEEN', $force);
@@ -555,13 +496,33 @@ function rcmail_send_unread_count($mbox_name, $force=false, $count=null)
if ($unseen != $old_unseen || ($mbox_name == 'INBOX'))
$RCMAIL->output->command('set_unread_count', $mbox_name, $unseen, ($mbox_name == 'INBOX'));
- // @TODO: this data is doubled (session and cache tables) if caching is enabled
- $_SESSION['unseen_count'][$mbox_name] = $unseen;
+ rcmail_set_unseen_count($mbox_name, $unseen);
return $unseen;
}
+function rcmail_set_unseen_count($mbox_name, $count)
+{
+ // @TODO: this data is doubled (session and cache tables) if caching is enabled
+
+ // Make sure we have an array here (#1487066)
+ if (!is_array($_SESSION['unseen_count']))
+ $_SESSION['unseen_count'] = array();
+
+ $_SESSION['unseen_count'][$mbox_name] = $count;
+}
+
+
+function rcmail_get_unseen_count($mbox_name)
+{
+ if (is_array($_SESSION['unseen_count']) && array_key_exists($mbox_name, $_SESSION['unseen_count']))
+ return $_SESSION['unseen_count'][$mbox_name];
+ else
+ return null;
+}
+
+
/**
* Sets message is_safe flag according to 'show_images' option value
*
@@ -966,10 +927,14 @@ function rcmail_message_headers($attrib, $headers=NULL)
else
$header_value = trim($IMAP->decode_header($value));
- $output_headers[$hkey] = array('title' => rcube_label($hkey), 'value' => $header_value, 'raw' => $value);
+ $output_headers[$hkey] = array(
+ 'title' => rcube_label(preg_replace('/(^mail-|-)/', '', $hkey)),
+ 'value' => $header_value, 'raw' => $value
+ );
}
- $plugin = $RCMAIL->plugins->exec_hook('message_headers_output', array('output' => $output_headers, 'headers' => $MESSAGE->headers));
+ $plugin = $RCMAIL->plugins->exec_hook('message_headers_output',
+ array('output' => $output_headers, 'headers' => $MESSAGE->headers));
// compose html table
$table = new html_table(array('cols' => 2));
diff --git a/program/steps/mail/getunread.inc b/program/steps/mail/getunread.inc
index a035f5204..e60f36cae 100644
--- a/program/steps/mail/getunread.inc
+++ b/program/steps/mail/getunread.inc
@@ -28,15 +28,18 @@ if (!empty($a_folders))
$check_all = (bool)$RCMAIL->config->get('check_all_folders');
foreach ($a_folders as $mbox_row) {
- if (!$check_all && isset($_SESSION['unseen_count'][$mbox_row]) && $mbox_row != $current)
- $unseen = $_SESSION['unseen_count'][$mbox_row];
+ $unseen_old = rcmail_get_unseen_count($mbox_row);
+
+ if (!$check_all && $unseen_old !== null && $mbox_row != $current)
+ $unseen = $unseen_old;
else
- $unseen = $IMAP->messagecount($mbox_row, 'UNSEEN', !isset($_SESSION['unseen_count'][$mbox_row]));
+ $unseen = $IMAP->messagecount($mbox_row, 'UNSEEN', $unseen_old === null);
- if ($unseen || !isset($_SESSION['unseen_count'][$mbox_row])) {
+ if ($unseen || $unseen_old === null) {
$OUTPUT->command('set_unread_count', $mbox_row, $unseen, $inbox && $mbox_row == 'INBOX');
}
- $_SESSION['unseen_count'][$mbox_row] = $unseen;
+
+ rcmail_set_unseen_count($mbox_row, $unseen);
}
}
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index 6353be7cc..7e6d294c8 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -106,8 +106,7 @@ if (isset($a_headers) && count($a_headers))
else {
// handle IMAP errors (e.g. #1486905)
if ($err_code = $IMAP->get_error_code()) {
- $err_str = $IMAP->get_error_str();
- $OUTPUT->show_message('servererrormsg', 'error', array('msg' => $err_str));
+ rcmail_display_server_error();
}
else if ($search_request)
$OUTPUT->show_message('searchnomatch', 'notice');
diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc
index 5411e3f46..1ff4407c5 100644
--- a/program/steps/mail/mark.inc
+++ b/program/steps/mail/mark.inc
@@ -47,7 +47,7 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va
// send error message
if ($_POST['_from'] != 'show')
$OUTPUT->command('list_mailbox');
- $OUTPUT->show_message('errormarking', 'error');
+ rcmail_display_server_error('errormarking');
$OUTPUT->send();
exit;
}
@@ -98,11 +98,11 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va
// update mailboxlist
$mbox = $IMAP->get_mailbox_name();
$unseen_count = $msg_count ? $IMAP->messagecount($mbox, 'UNSEEN') : 0;
- $old_unseen = $_SESSION['unseen_count'][$mbox];
+ $old_unseen = rcmail_get_unseen_count($mbox);
if ($old_unseen != $unseen_count) {
$OUTPUT->command('set_unread_count', $mbox, $unseen_count, ($mbox == 'INBOX'));
- $_SESSION['unseen_count'][$mbox] = $unseen_count;
+ rcmail_set_unseen_count($mbox, $unseen_count);
}
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count));
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index 3940b6db9..2db3ec31a 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -39,7 +39,7 @@ if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_targe
// send error message
if ($_POST['_from'] != 'show')
$OUTPUT->command('list_mailbox');
- $OUTPUT->show_message('errormoving', 'error');
+ rcmail_display_server_error('errormoving');
$OUTPUT->send();
exit;
}
@@ -60,7 +60,7 @@ else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) {
// send error message
if ($_POST['_from'] != 'show')
$OUTPUT->command('list_mailbox');
- $OUTPUT->show_message('errordeleting', 'error');
+ rcmail_display_server_error('errordeleting');
$OUTPUT->send();
exit;
}
@@ -109,11 +109,11 @@ else
// update mailboxlist
$mbox = $IMAP->get_mailbox_name();
$unseen_count = $msg_count ? $IMAP->messagecount($mbox, 'UNSEEN') : 0;
- $old_unseen = $_SESSION['unseen_count'][$mbox];
-
+ $old_unseen = rcmail_get_unseen_count($mbox);
+
if ($old_unseen != $unseen_count) {
$OUTPUT->command('set_unread_count', $mbox, $unseen_count, ($mbox == 'INBOX'));
- $_SESSION['unseen_count'][$mbox] = $unseen_count;
+ rcmail_set_unseen_count($mbox, $unseen_count);
}
if ($RCMAIL->action=='moveto' && strlen($target)) {
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index 90d1c374c..39fb32fc9 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -124,8 +124,7 @@ if (!empty($result_h)) {
}
// handle IMAP errors (e.g. #1486905)
else if ($err_code = $IMAP->get_error_code()) {
- $err_str = $IMAP->get_error_str();
- $OUTPUT->show_message('servererrormsg', 'error', array('msg' => $err_str));
+ rcmail_display_server_error();
}
else {
$OUTPUT->show_message('searchnomatch', 'notice');
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 796e7782b..09f12ed07 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -70,7 +70,7 @@ function rcmail_encrypt_header($what)
function rcmail_get_identity($id)
{
global $USER, $OUTPUT;
-
+
if ($sql_arr = $USER->get_identity($id)) {
$out = $sql_arr;
$out['mailto'] = $sql_arr['email'];
@@ -100,7 +100,7 @@ function rcmail_fix_emoticon_paths(&$mime_message)
// remove any null-byte characters before parsing
$body = preg_replace('/\x00/', '', $body);
-
+
$searchstr = 'program/js/tiny_mce/plugins/emotions/img/';
$offset = 0;
@@ -193,6 +193,7 @@ function rcmail_email_input_format($mailto, $count=false, $check=true)
return implode(', ', $result);
}
+
/****** compose message ********/
if (strlen($_POST['_draft_saveid']) > 3)
@@ -297,12 +298,12 @@ $headers['From'] = rcube_charset_convert($from_string, RCMAIL_CHARSET, $message_
$headers['To'] = $mailto;
// additional recipients
-if (!empty($mailcc))
+if (!empty($mailcc)) {
$headers['Cc'] = $mailcc;
-
-if (!empty($mailbcc))
+}
+if (!empty($mailbcc)) {
$headers['Bcc'] = $mailbcc;
-
+}
if (!empty($identity_arr['bcc'])) {
$headers['Bcc'] = ($headers['Bcc'] ? $headers['Bcc'].', ' : '') . $identity_arr['bcc'];
$RECIPIENT_COUNT ++;
@@ -318,36 +319,43 @@ if (($max_recipients = (int) $RCMAIL->config->get('max_recipients')) > 0) {
// add subject
$headers['Subject'] = trim(get_input_value('_subject', RCUBE_INPUT_POST, TRUE, $message_charset));
-if (!empty($identity_arr['organization']))
+if (!empty($identity_arr['organization'])) {
$headers['Organization'] = $identity_arr['organization'];
-
-if (!empty($_POST['_replyto']))
+}
+if (!empty($_POST['_replyto'])) {
$headers['Reply-To'] = rcmail_email_input_format(get_input_value('_replyto', RCUBE_INPUT_POST, TRUE, $message_charset));
-else if (!empty($identity_arr['reply-to']))
+}
+else if (!empty($identity_arr['reply-to'])) {
$headers['Reply-To'] = rcmail_email_input_format($identity_arr['reply-to'], false, true);
-
-if (!empty($_POST['_mailfollowupto']))
- $headers['Mail-Followup-To'] = rcmail_email_input_format(get_input_value('_mailfollowupto', RCUBE_INPUT_POST, TRUE, $message_charset));
-if (!empty($_POST['_mailreplyto']))
- $headers['Mail-Reply-To'] = rcmail_email_input_format(get_input_value('_mailreplyto', RCUBE_INPUT_POST, TRUE, $message_charset));
-
-if (!empty($_SESSION['compose']['reply_msgid']))
+}
+if (!empty($headers['Reply-To'])) {
+ $headers['Mail-Reply-To'] = $headers['Reply-To'];
+}
+if (!empty($_POST['_followupto'])) {
+ $headers['Mail-Followup-To'] = rcmail_email_input_format(get_input_value('_followupto', RCUBE_INPUT_POST, TRUE, $message_charset));
+}
+if (!empty($_SESSION['compose']['reply_msgid'])) {
$headers['In-Reply-To'] = $_SESSION['compose']['reply_msgid'];
+}
// remember reply/forward UIDs in special headers
-if (!empty($_SESSION['compose']['reply_uid']) && $savedraft)
+if (!empty($_SESSION['compose']['reply_uid']) && $savedraft) {
$headers['X-Draft-Info'] = array('type' => 'reply', 'uid' => $_SESSION['compose']['reply_uid']);
-else if (!empty($_SESSION['compose']['forward_uid']) && $savedraft)
+}
+else if (!empty($_SESSION['compose']['forward_uid']) && $savedraft) {
$headers['X-Draft-Info'] = array('type' => 'forward', 'uid' => $_SESSION['compose']['forward_uid']);
+}
-if (!empty($_SESSION['compose']['references']))
+if (!empty($_SESSION['compose']['references'])) {
$headers['References'] = $_SESSION['compose']['references'];
+}
if (!empty($_POST['_priority'])) {
$priority = intval($_POST['_priority']);
$a_priorities = array(1=>'highest', 2=>'high', 4=>'low', 5=>'lowest');
- if ($str_priority = $a_priorities[$priority])
+ if ($str_priority = $a_priorities[$priority]) {
$headers['X-Priority'] = sprintf("%d (%s)", $priority, ucfirst($str_priority));
+ }
}
if (!empty($_POST['_receipt'])) {
@@ -359,11 +367,12 @@ if (!empty($_POST['_receipt'])) {
$headers['Message-ID'] = $message_id;
$headers['X-Sender'] = $from;
-if (is_array($headers['X-Draft-Info']))
+if (is_array($headers['X-Draft-Info'])) {
$headers['X-Draft-Info'] = rcmail_draftinfo_encode($headers['X-Draft-Info'] + array('folder' => $_SESSION['compose']['mailbox']));
-
-if (!empty($CONFIG['useragent']))
+}
+if (!empty($CONFIG['useragent'])) {
$headers['User-Agent'] = $CONFIG['useragent'];
+}
// exec hook for header checking and manipulation
$data = $RCMAIL->plugins->exec_hook('message_outgoing_headers', array('headers' => $headers));
@@ -441,13 +450,16 @@ if ($isHtml) {
$MAIL_MIME->setHTMLBody($plugin['body']);
+ // replace emoticons
+ $plugin['body'] = rcmail_replace_emoticons($plugin['body']);
+
// add a plain text version of the e-mail as an alternative part.
$h2t = new html2text($plugin['body'], false, true, 0);
$plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n");
$plainTextPart = wordwrap($plainTextPart, 998, "\r\n", true);
if (!$plainTextPart) {
- // empty message body breaks attachment handling in drafts
- $plainTextPart = "\r\n";
+ // empty message body breaks attachment handling in drafts
+ $plainTextPart = "\r\n";
}
else {
// make sure all line endings are CRLF (#1486712)
@@ -513,9 +525,10 @@ if (is_array($_SESSION['compose']['attachments']))
($attachment['data'] ? false : true),
($ctype == 'message/rfc822' ? '8bit' : 'base64'),
($ctype == 'message/rfc822' ? 'inline' : 'attachment'),
- $message_charset, '', '',
+ '', '', '',
$CONFIG['mime_param_folding'] ? 'quoted-printable' : NULL,
- $CONFIG['mime_param_folding'] == 2 ? 'quoted-printable' : NULL
+ $CONFIG['mime_param_folding'] == 2 ? 'quoted-printable' : NULL,
+ '', RCMAIL_CHARSET
);
}
}
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index e660207cd..45dd8e168 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -196,8 +196,11 @@ else
if ($MESSAGE && $MESSAGE->headers && !$MESSAGE->headers->seen &&
($RCMAIL->action == 'show' || ($RCMAIL->action == 'preview' && intval($CONFIG['preview_pane_mark_read']) == 0)))
{
- if ($IMAP->set_flag($MESSAGE->uid, 'SEEN') && $_SESSION['unseen_count'][$mbox_name])
- $_SESSION['unseen_count'][$mbox_name] -= 1;
+ if ($IMAP->set_flag($MESSAGE->uid, 'SEEN')) {
+ if ($count = rcmail_get_unseen_count($mbox_name)) {
+ rcmail_set_unseen_count($mbox_name, $count - 1);
+ }
+ }
}
exit;