Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add option to use envelope From address for MDN responses (#1488880)

  • Loading branch information...
commit 232535f76e50c08e77d8cba599fabe7fe8ca42d4 1 parent b903c21
Aleksander Machniak alecpl authored
1  CHANGELOG
... ... @@ -1,6 +1,7 @@
1 1 CHANGELOG Roundcube Webmail
2 2 ===========================
3 3
  4 +- Add option to use envelope From address for MDN responses (#1488880)
4 5 - Add possibility to search in message body only (#1488770)
5 6 - Support "multipart/relative" as an alias for "multipart/related" type (#1488886)
6 7 - Display PGP/MIME signature attachments as "Digital Signature" (#1488570)
4 config/main.inc.php.dist
@@ -353,6 +353,10 @@ $rcmail_config['line_length'] = 72;
353 353 // send plaintext messages as format=flowed
354 354 $rcmail_config['send_format_flowed'] = true;
355 355
  356 +// According to RFC2298, return receipt envelope sender address must be empty.
  357 +// If this option is true, Roundcube will use user's identity as envelope sender for MDN responses.
  358 +$rcmail_config['mdn_use_from'] = false;
  359 +
356 360 // Set identities access level:
357 361 // 0 - many identities with possibility to edit all params
358 362 // 1 - many identities with possibility to edit all params but not email address
3  program/lib/Roundcube/rcube_smtp.php
@@ -227,7 +227,8 @@ public function send_mail($from, $recipients, &$headers, &$body, $opts=null)
227 227 }
228 228
229 229 // RFC2298.3: remove envelope sender address
230   - if (preg_match('/Content-Type: multipart\/report/', $text_headers)
  230 + if (empty($opts['mdn_use_from'])
  231 + && preg_match('/Content-Type: multipart\/report/', $text_headers)
231 232 && preg_match('/report-type=disposition-notification/', $text_headers)
232 233 ) {
233 234 $from = '';
5 program/steps/mail/func.inc
@@ -1687,6 +1687,9 @@ function rcmail_send_mdn($message, &$smtp_error)
1687 1687 if ($agent = $RCMAIL->config->get('useragent'))
1688 1688 $headers['User-Agent'] = $agent;
1689 1689
  1690 + if ($RCMAIL->config->get('mdn_use_from'))
  1691 + $options['mdn_use_from'] = true;
  1692 +
1690 1693 $body = rcube_label("yourmessage") . "\r\n\r\n" .
1691 1694 "\t" . rcube_label("to") . ': ' . rcube_mime::decode_mime_string($message->headers->to, $message->headers->charset) . "\r\n" .
1692 1695 "\t" . rcube_label("subject") . ': ' . $message->subject . "\r\n" .
@@ -1708,7 +1711,7 @@ function rcmail_send_mdn($message, &$smtp_error)
1708 1711 $compose->setTXTBody(rc_wordwrap($body, 75, "\r\n"));
1709 1712 $compose->addAttachment($report, 'message/disposition-notification', 'MDNPart2.txt', false, '7bit', 'inline');
1710 1713
1711   - $sent = rcmail_deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file);
  1714 + $sent = rcmail_deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file, $options);
1712 1715
1713 1716 if ($sent)
1714 1717 {

0 comments on commit 232535f

Please sign in to comment.
Something went wrong with that request. Please try again.