summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-01-02 19:25:07 +0100
committerAleksander Machniak <alec@alec.pl>2013-01-02 19:25:07 +0100
commit232535f76e50c08e77d8cba599fabe7fe8ca42d4 (patch)
tree447a34364be356fbb3b03cc859ecbef025ef72df
parentb903c2145084f2d294a92e98971ab14ba47aa060 (diff)
Add option to use envelope From address for MDN responses (#1488880)
-rw-r--r--CHANGELOG1
-rw-r--r--config/main.inc.php.dist4
-rw-r--r--program/lib/Roundcube/rcube_smtp.php3
-rw-r--r--program/steps/mail/func.inc5
4 files changed, 11 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index d3ebabc3e..8b26fbc14 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Add option to use envelope From address for MDN responses (#1488880)
- Add possibility to search in message body only (#1488770)
- Support "multipart/relative" as an alias for "multipart/related" type (#1488886)
- Display PGP/MIME signature attachments as "Digital Signature" (#1488570)
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 20b8795e1..e6cb9fd4c 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -353,6 +353,10 @@ $rcmail_config['line_length'] = 72;
// send plaintext messages as format=flowed
$rcmail_config['send_format_flowed'] = true;
+// According to RFC2298, return receipt envelope sender address must be empty.
+// If this option is true, Roundcube will use user's identity as envelope sender for MDN responses.
+$rcmail_config['mdn_use_from'] = false;
+
// Set identities access level:
// 0 - many identities with possibility to edit all params
// 1 - many identities with possibility to edit all params but not email address
diff --git a/program/lib/Roundcube/rcube_smtp.php b/program/lib/Roundcube/rcube_smtp.php
index 79ffcfbf8..5c7d2203c 100644
--- a/program/lib/Roundcube/rcube_smtp.php
+++ b/program/lib/Roundcube/rcube_smtp.php
@@ -227,7 +227,8 @@ class rcube_smtp
}
// RFC2298.3: remove envelope sender address
- if (preg_match('/Content-Type: multipart\/report/', $text_headers)
+ if (empty($opts['mdn_use_from'])
+ && preg_match('/Content-Type: multipart\/report/', $text_headers)
&& preg_match('/report-type=disposition-notification/', $text_headers)
) {
$from = '';
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 44a1557c3..f82e60a36 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1687,6 +1687,9 @@ function rcmail_send_mdn($message, &$smtp_error)
if ($agent = $RCMAIL->config->get('useragent'))
$headers['User-Agent'] = $agent;
+ if ($RCMAIL->config->get('mdn_use_from'))
+ $options['mdn_use_from'] = true;
+
$body = rcube_label("yourmessage") . "\r\n\r\n" .
"\t" . rcube_label("to") . ': ' . rcube_mime::decode_mime_string($message->headers->to, $message->headers->charset) . "\r\n" .
"\t" . rcube_label("subject") . ': ' . $message->subject . "\r\n" .
@@ -1708,7 +1711,7 @@ function rcmail_send_mdn($message, &$smtp_error)
$compose->setTXTBody(rc_wordwrap($body, 75, "\r\n"));
$compose->addAttachment($report, 'message/disposition-notification', 'MDNPart2.txt', false, '7bit', 'inline');
- $sent = rcmail_deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file);
+ $sent = rcmail_deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file, $options);
if ($sent)
{