Aleksander Machniak
2015-08-07 1b39d9a6c744a393e7930c2493cc2ddc9c9e95bf
program/lib/Roundcube/rcube.php
@@ -124,8 +124,8 @@
    /**
     * This implements the 'singleton' design pattern
     *
     * @param integer Options to initialize with this instance. See rcube::INIT_WITH_* constants
     * @param string Environment name to run (e.g. live, dev, test)
     * @param integer $mode Options to initialize with this instance. See rcube::INIT_WITH_* constants
     * @param string  $env  Environment name to run (e.g. live, dev, test)
     *
     * @return rcube The one and only instance
     */
@@ -1559,12 +1559,8 @@
            if (strlen($headers['Bcc']))
                $a_recipients[] = $headers['Bcc'];
            // clean Bcc from header for recipients
            $send_headers = $headers;
            unset($send_headers['Bcc']);
            // here too, it because txtHeaders() below use $message->_headers not only $send_headers
            unset($message->_headers['Bcc']);
            // remove Bcc header and get the whole head of the message as string
            $send_headers = array('Bcc' => null);
            $smtp_headers = $message->txtHeaders($send_headers, true);
            if ($message->getParam('delay_file_io')) {
@@ -1606,13 +1602,9 @@
        // send mail using PHP's mail() function
        else {
            // unset some headers because they will be added by the mail() function
            $headers_enc = $message->headers($headers);
            $headers_php = $message->_headers;
            unset($headers_php['To'], $headers_php['Subject']);
            // reset stored headers and overwrite
            $message->_headers = array();
            $header_str = $message->txtHeaders($headers_php);
            $headers_enc = $headers;
            $headers_res = array('To' => null, 'Subject' => null);
            $header_str  = $message->txtHeaders($headers_res, true);
            // #1485779
            if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
@@ -1685,8 +1677,7 @@
            fclose($msg_body);
        }
        $message->_headers = array();
        $message->headers($headers);
        $message->headers($headers, true);
        return $sent;
    }