From e04e3144407b7a863999d8aeaf6c3a653219359f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 24 Oct 2012 12:24:37 +0200 Subject: Add option to disable saving sent mail in Sent folder - no_save_sent_messages (#1488686) --- CHANGELOG | 1 + config/main.inc.php.dist | 10 +++++++--- program/steps/mail/compose.inc | 5 +++++ program/steps/mail/sendmail.inc | 11 +++++------ skins/classic/templates/compose.html | 4 ++-- skins/larry/templates/compose.html | 2 ++ 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d9707f8cd..ff33fd99f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Add option to disable saving sent mail in Sent folder - no_save_sent_messages (#1488686) - Fix handling dont_override with message_sort_col and message_sort_order settings (#1488760) - Fix HTML part detection in messages with attachments (#1488769) - Fix bug where wrong words were highlighted on spell-before-send check diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist index 371ccaf8c..018cea639 100644 --- a/config/main.inc.php.dist +++ b/config/main.inc.php.dist @@ -182,6 +182,9 @@ $rcmail_config['smtp_timeout'] = 0; // ONLY ENABLE IT IF YOU'RE REALLY SURE WHAT YOU'RE DOING! $rcmail_config['enable_installer'] = false; +// don't allow these settings to be overriden by the user +$rcmail_config['dont_override'] = array(); + // provide an URL where a user can get support for this Roundcube installation // PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE! $rcmail_config['support_url'] = ''; @@ -349,9 +352,6 @@ $rcmail_config['line_length'] = 72; // send plaintext messages as format=flowed $rcmail_config['send_format_flowed'] = true; -// don't allow these settings to be overriden by the user -$rcmail_config['dont_override'] = array(); - // Set identities access level: // 0 - many identities with possibility to edit all params // 1 - many identities with possibility to edit all params but not email address @@ -379,6 +379,10 @@ $rcmail_config['contact_photo_size'] = 160; // Enable DNS checking for e-mail address validation $rcmail_config['email_dns_check'] = false; +// Disables saving sent messages in Sent folder (like gmail) (Default: false) +// Note: useful when SMTP server stores sent mail in user mailbox +$rcmail_config['no_save_sent_messages'] = false; + // ---------------------------------- // PLUGINS // ---------------------------------- diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 691eca2db..7ac9a8d39 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -1528,6 +1528,11 @@ function rcmail_check_sent_folder($folder, $create=false) { global $RCMAIL; + // we'll not save the message, so it doesn't matter + if ($RCMAIL->config->get('no_save_sent_messages')) { + return true; + } + if ($RCMAIL->storage->folder_exists($folder, true)) { return true; } diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 9fe510794..4fac872d1 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -49,7 +49,7 @@ if (!$savedraft) { if(!empty($CONFIG['sendmail_delay'])) { $wait_sec = time() - intval($CONFIG['sendmail_delay']) - intval($CONFIG['last_message_time']); - if($wait_sec < 0) { + if ($wait_sec < 0) { $OUTPUT->show_message('senttooquickly', 'error', array('sec' => $wait_sec * -1)); $OUTPUT->send('iframe'); } @@ -676,19 +676,18 @@ if (!$savedraft) $smtp_error, $mailbody_file, $smtp_opts); // return to compose page if sending failed - if (!$sent) - { + if (!$sent) { // remove temp file if ($mailbody_file) { unlink($mailbody_file); - } + } if ($smtp_error) $OUTPUT->show_message($smtp_error['label'], 'error', $smtp_error['vars']); else $OUTPUT->show_message('sendingfailed', 'error'); $OUTPUT->send('iframe'); - } + } // save message sent time if (!empty($CONFIG['sendmail_delay'])) @@ -706,7 +705,7 @@ if (!$savedraft) // Determine which folder to save message if ($savedraft) $store_target = $CONFIG['drafts_mbox']; -else +else if (!$RCMAIL->config->get('no_save_sent_messages')) $store_target = isset($_POST['_store_target']) ? get_input_value('_store_target', RCUBE_INPUT_POST) : $CONFIG['sent_mbox']; if ($store_target) { diff --git a/skins/classic/templates/compose.html b/skins/classic/templates/compose.html index 1e1403e18..23998ee0f 100644 --- a/skins/classic/templates/compose.html +++ b/skins/classic/templates/compose.html @@ -143,10 +143,10 @@ - + - + diff --git a/skins/larry/templates/compose.html b/skins/larry/templates/compose.html index d29c1bd2a..ef49ece90 100644 --- a/skins/larry/templates/compose.html +++ b/skins/larry/templates/compose.html @@ -140,9 +140,11 @@ + + -- cgit v1.2.3