Aleksander Machniak
2013-10-14 c1bc8f6c827a27540b5510b42dcc65b39d38f2c1
program/lib/Roundcube/rcube_smtp.php
@@ -2,8 +2,6 @@
/*
 +-----------------------------------------------------------------------+
 | program/include/rcube_smtp.php                                        |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2012, The Roundcube Dev Team                       |
 |                                                                       |
@@ -13,7 +11,6 @@
 |                                                                       |
 | PURPOSE:                                                              |
 |   Provide SMTP functionality using socket connections                 |
 |                                                                       |
 +-----------------------------------------------------------------------+
 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
 +-----------------------------------------------------------------------+
@@ -35,6 +32,8 @@
    // define headers delimiter
    const SMTP_MIME_CRLF = "\r\n";
    const DEBUG_LINE_LENGTH = 4098; // 4KB + 2B for \r\n
    /**
@@ -122,7 +121,7 @@
        }
        // try to connect to server and exit on failure
        $result = $this->conn->connect($smtp_timeout);
        $result = $this->conn->connect($CONFIG['smtp_timeout']);
        if (PEAR::isError($result)) {
            $this->response[] = "Connection failed: ".$result->getMessage();
@@ -230,7 +229,8 @@
        }
        // 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 = '';
@@ -329,6 +329,12 @@
     */
    public function debug_handler(&$smtp, $message)
    {
        if (($len = strlen($message)) > self::DEBUG_LINE_LENGTH) {
            $diff    = $len - self::DEBUG_LINE_LENGTH;
            $message = substr($message, 0, self::DEBUG_LINE_LENGTH)
                . "... [truncated $diff bytes]";
        }
        rcube::write_log('smtp', preg_replace('/\r\n$/', '', $message));
    }
@@ -435,9 +441,9 @@
        $recipients = rcube_utils::explode_quoted_string(',', $recipients);
        reset($recipients);
        while (list($k, $recipient) = each($recipients)) {
        foreach ($recipients as $recipient) {
            $a = rcube_utils::explode_quoted_string(' ', $recipient);
            while (list($k2, $word) = each($a)) {
            foreach ($a as $word) {
                if (strpos($word, "@") > 0 && $word[strlen($word)-1] != '"') {
                    $word = preg_replace('/^<|>$/', '', trim($word));
                    if (in_array($word, $addresses) === false) {