From 232535f76e50c08e77d8cba599fabe7fe8ca42d4 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 2 Jan 2013 19:25:07 +0100 Subject: Add option to use envelope From address for MDN responses (#1488880) --- program/lib/Roundcube/rcube_smtp.php | 3 ++- program/steps/mail/func.inc | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'program') 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) { -- cgit v1.2.3