diff options
Diffstat (limited to 'program/steps/mail')
-rw-r--r-- | program/steps/mail/compose.inc | 1 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index e3f8f57a6..3935ec36a 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -1523,6 +1523,7 @@ function get_form_tags($attrib) $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task)); $hiddenfields->add(array('name' => '_action', 'value' => 'send')); $hiddenfields->add(array('name' => '_id', 'value' => $COMPOSE['id'])); + $hiddenfields->add(array('name' => '_attachments')); $form_start = empty($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : ''; $form_start .= $hiddenfields->show(); diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 4790d35e2..70f1af714 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -458,6 +458,19 @@ if ($isHtml) { $message_body .= "\r\n</body></html>\r\n"; } +// sort attachments to make sure the order is the same as in the UI (#1488423) +$files = get_input_value('_attachments', RCUBE_INPUT_POST); +if ($files) { + $files = explode(',', $files); + $files = array_flip($files); + foreach ($files as $idx => $val) { + $files[$idx] = $COMPOSE['attachments'][$idx]; + unset($COMPOSE['attachments'][$idx]); + } + + $COMPOSE['attachments'] = array_merge(array_filter($files), $COMPOSE['attachments']); +} + // set line length for body wrapping $LINE_LENGTH = $RCMAIL->config->get('line_length', 72); |