From faf8766fd2a34ad1eaf1545bab659ab459c074ad Mon Sep 17 00:00:00 2001 From: thomascube Date: Thu, 31 Jul 2008 21:08:17 +0000 Subject: Save outgoing mail to selectable folder (#1324581) --- program/steps/mail/compose.inc | 9 +++++++++ program/steps/mail/sendmail.inc | 14 +++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'program/steps/mail') diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 9da449d54..8e5a7c2ef 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -776,6 +776,14 @@ function rcmail_editor_selector($attrib) } +function rcmail_store_target_selection($attrib) +{ + $attrib['name'] = '_store_target'; + $select = rcmail_mailbox_select(array('noselection' => '- '.rcube_label('dontsave').' -')); + return $select->show(rcmail::get_instance()->config->get('sent_mbox'), $attrib); +} + + function get_form_tags($attrib) { global $RCMAIL, $MESSAGE_FORM; @@ -813,6 +821,7 @@ $OUTPUT->add_handlers(array( 'priorityselector' => 'rcmail_priority_selector', 'editorselector' => 'rcmail_editor_selector', 'receiptcheckbox' => 'rcmail_receipt_checkbox', + 'storetarget' => 'rcmail_store_target_selection', )); /****** get contacts for this user and add them to client scripts ********/ diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 75000d4aa..090919e35 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -355,27 +355,27 @@ if (!$savedraft) // Determine which folder to save message if ($savedraft) - $store_target = 'drafts_mbox'; + $store_target = $CONFIG['drafts_mbox']; else - $store_target = 'sent_mbox'; + $store_target = isset($_POST['_store_target']) ? get_input_value('_store_target', RCUBE_INPUT_POST) : $CONFIG['sent_mbox']; -if ($CONFIG[$store_target]) +if ($store_target) { // check if mailbox exists - if (!in_array_nocase($CONFIG[$store_target], $IMAP->list_mailboxes())) - $store_folder = $IMAP->create_mailbox($CONFIG[$store_target], TRUE); + if (!in_array_nocase($store_target, $IMAP->list_mailboxes())) + $store_folder = $IMAP->create_mailbox($store_target, TRUE); else $store_folder = TRUE; // append message to sent box if ($store_folder) - $saved = $IMAP->save_message($CONFIG[$store_target], $MAIL_MIME->getMessage()); + $saved = $IMAP->save_message($store_target, $MAIL_MIME->getMessage()); // raise error if saving failed if (!$saved) { raise_error(array('code' => 800, 'type' => 'imap', 'file' => __FILE__, - 'message' => "Could not save message in $CONFIG[$store_target]"), TRUE, FALSE); + 'message' => "Could not save message in $store_target"), TRUE, FALSE); $OUTPUT->show_message('errorsaving', 'error'); $OUTPUT->send('iframe'); -- cgit v1.2.3