summaryrefslogtreecommitdiff
path: root/program/steps/mail/sendmail.inc
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-08-05 12:41:16 +0200
committerAleksander Machniak <alec@alec.pl>2012-08-05 12:41:16 +0200
commitb169de8fcde5587f49863ffe99c1f915a9e96ba8 (patch)
treec1089c9cb662a2c3727d76ef80b15bd9355b674e /program/steps/mail/sendmail.inc
parentedd2565bf370f5a8302507875f9e1c671eed6325 (diff)
- Fix order of attachments in sent mail (#1488423)
Diffstat (limited to 'program/steps/mail/sendmail.inc')
-rw-r--r--program/steps/mail/sendmail.inc13
1 files changed, 13 insertions, 0 deletions
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);