summaryrefslogtreecommitdiff
path: root/program/steps/mail/func.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-05-29 17:01:15 +0000
committeralecpl <alec@alec.pl>2010-05-29 17:01:15 +0000
commitac8edbed3542fb62cf23b49a0dfd6f4692898be5 (patch)
tree44a58abedc25265ec4abc6107d4ae6eab2bc2f73 /program/steps/mail/func.inc
parentfc1b7226b4b0e0226e9a176d39e2dc94c6cddc1a (diff)
- Fix use RFC-compliant line-delimiter when saving messages on IMAP (#1486712)
Diffstat (limited to 'program/steps/mail/func.inc')
-rw-r--r--program/steps/mail/func.inc25
1 files changed, 19 insertions, 6 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 93eb97fd4..b07e3a6d9 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1366,8 +1366,8 @@ function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
if (preg_match_all('/<([^@]+@[^>]+)>/', $headers_enc['To'], $m)) {
$headers_enc['To'] = implode(', ', $m[1]);
- }
}
+ }
$msg_body = $message->get();
@@ -1376,10 +1376,23 @@ function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_
'file' => __FILE__, 'line' => __LINE__,
'message' => "Could not create message: ".$msg_body->getMessage()),
TRUE, FALSE);
- else if (ini_get('safe_mode'))
- $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str);
- else
- $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str, "-f$from");
+ else {
+ $delim = $RCMAIL->config->header_delimiter();
+ $to = $headers_enc['To'];
+ $subject = $headers_enc['Subject'];
+
+ if ($delim != "\r\n") {
+ $header_str = str_replace("\r\n", $delim, $header_str);
+ $msg_body = str_replace("\r\n", $delim, $msg_body);
+ $to = str_replace("\r\n", $delim, $to);
+ $subject = str_replace("\r\n", $delim, $subject);
+ }
+
+ if (ini_get('safe_mode'))
+ $sent = mail($to, $subject, $msg_body, $header_str);
+ else
+ $sent = mail($to, $subject, $msg_body, $header_str, "-f$from");
+ }
}
if ($sent) {
@@ -1418,7 +1431,7 @@ function rcmail_send_mdn($uid, &$smtp_error)
$recipient = array_shift($IMAP->decode_address_list($message->headers->mdn_to));
$mailto = $recipient['mailto'];
- $compose = new Mail_mime($RCMAIL->config->header_delimiter());
+ $compose = new Mail_mime("\r\n");
$compose->setParam('text_encoding', 'quoted-printable');
$compose->setParam('html_encoding', 'quoted-printable');