summaryrefslogtreecommitdiff
path: root/program/steps/mail/sendmail.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail/sendmail.inc')
-rw-r--r--program/steps/mail/sendmail.inc35
1 files changed, 23 insertions, 12 deletions
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index c55e40064..5843de43f 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -144,7 +144,7 @@ if ($RCMAIL->config->get('http_received_header')) {
$http_header .= $nldlm . ' via ';
}
- $host = $_SERVER['REMOTE_ADDR'];
+ $host = $_SERVER['REMOTE_ADDR'];
$hostname = gethostbyaddr($host);
if ($encrypt) {
@@ -171,7 +171,7 @@ if ($RCMAIL->config->get('http_received_header')) {
$headers['Date'] = $RCMAIL->user_date();
$headers['From'] = rcube_charset::convert($from_string, RCUBE_CHARSET, $message_charset);
-$headers['To'] = $mailto;
+$headers['To'] = $mailto;
// additional recipients
if (!empty($mailcc)) {
@@ -188,6 +188,10 @@ if (($max_recipients = (int) $RCMAIL->config->get('max_recipients')) > 0) {
}
}
+$dont_override = (array) $RCMAIL->config->get('dont_override');
+$mdn_enabled = in_array('mdn_default', $dont_override) ? $RCMAIL->config->get('mdn_default') : !empty($_POST['_mdn']);
+$dsn_enabled = in_array('dsn_default', $dont_override) ? $RCMAIL->config->get('dsn_default') : !empty($_POST['_dsn']);
+
// add subject
$headers['Subject'] = trim(rcube_utils::get_input_value('_subject', rcube_utils::INPUT_POST, TRUE, $message_charset));
@@ -228,7 +232,7 @@ if (!empty($_POST['_priority'])) {
}
}
-if (!empty($_POST['_receipt'])) {
+if ($mdn_enabled) {
$headers['Return-Receipt-To'] = $from_string;
$headers['Disposition-Notification-To'] = $from_string;
}
@@ -520,9 +524,7 @@ if (!$savedraft) {
}
// Handle Delivery Status Notification request
- if (!empty($_POST['_dsn'])) {
- $smtp_opts['dsn'] = true;
- }
+ $smtp_opts['dsn'] = $dsn_enabled;
$sent = $RCMAIL->deliver_message($MAIL_MIME, $from, $mailto,
$smtp_error, $mailbody_file, $smtp_opts);
@@ -682,11 +684,16 @@ if ($savedraft) {
$OUTPUT->command('auto_save_start');
}
else {
+ // Collect folders which could contain the composed message,
+ // we'll refresh the list if currently opened folder is one of them (#1490238)
$folders = array();
- if ($COMPOSE['mode'] == 'reply' || $COMPOSE['mode'] == 'forward') {
+ if (in_array($COMPOSE['mode'], array('reply', 'forward', 'draft'))) {
$folders[] = $COMPOSE['mailbox'];
}
+ if (!empty($COMPOSE['param']['draft_uid']) && $drafts_mbox) {
+ $folders[] = $drafts_mbox;
+ }
rcmail_compose_cleanup($COMPOSE_ID);
$OUTPUT->command('remove_compose_data', $COMPOSE_ID);
@@ -758,8 +765,10 @@ function rcmail_fix_emoticon_paths($mime_message)
// remove any null-byte characters before parsing
$body = preg_replace('/\x00/', '', $body);
- $searchstr = 'program/js/tinymce/plugins/emoticons/img/';
- $offset = 0;
+ $searchstr = 'program/js/tinymce/plugins/emoticons/img/';
+ $assets_dir = $RCMAIL->config->get('assets_dir');
+ $path = ($assets_dir ?: INSTALL_PATH) . '/' . $searchstr;
+ $offset = 0;
// keep track of added images, so they're only added once
$included_images = array();
@@ -772,12 +781,14 @@ function rcmail_fix_emoticon_paths($mime_message)
// sanitize image name so resulting attachment doesn't leave images dir
$image_name = preg_replace('/[^a-zA-Z0-9_\.\-]/i', '', $image_name);
- $img_file = INSTALL_PATH . '/' . $searchstr . $image_name;
+ $img_file = $path . $image_name;
- if (! in_array($image_name, $included_images)) {
+ if (!in_array($image_name, $included_images)) {
// add the image to the MIME message
- if (!$mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name)) {
+ $res = $mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name);
+ if (PEAR::isError($res)) {
$RCMAIL->output->show_message("emoticonerror", 'error');
+ continue;
}
array_push($included_images, $image_name);