From e99b3f2e6e83c38d959e52e09fd833ec90fd39b2 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 20 Sep 2011 15:17:04 -0400
Subject: [PATCH] - Fix listing messages on servers without SORT and THREAD command
---
program/include/rcube_smtp.php | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/program/include/rcube_smtp.php b/program/include/rcube_smtp.php
index 654c7ef..73c30d2 100644
--- a/program/include/rcube_smtp.php
+++ b/program/include/rcube_smtp.php
@@ -105,7 +105,7 @@
$this->conn = new Net_SMTP($smtp_host, $smtp_port, $helo_host);
- if($RCMAIL->config->get('smtp_debug'))
+ if ($RCMAIL->config->get('smtp_debug'))
$this->conn->setDebug(true, array($this, 'debug_handler'));
// try to connect to server and exit on failure
@@ -116,6 +116,13 @@
$this->error = array('label' => 'smtpconnerror', 'vars' => array('code' => $this->conn->_code));
$this->conn = null;
return false;
+ }
+
+ // workaround for timeout bug in Net_SMTP 1.5.[0-1] (#1487843)
+ if (method_exists($this->conn, 'setTimeout')
+ && ($timeout = ini_get('default_socket_timeout'))
+ ) {
+ $this->conn->setTimeout($timeout);
}
$smtp_user = str_replace('%u', $_SESSION['username'], $CONFIG['smtp_user']);
@@ -432,14 +439,14 @@
// if we're passed an array, assume addresses are valid and implode them before parsing.
if (is_array($recipients))
$recipients = implode(', ', $recipients);
-
+
$addresses = array();
$recipients = rcube_explode_quoted_string(',', $recipients);
reset($recipients);
while (list($k, $recipient) = each($recipients))
{
- $a = explode(" ", $recipient);
+ $a = rcube_explode_quoted_string(' ', $recipient);
while (list($k2, $word) = each($a))
{
if (strpos($word, "@") > 0 && $word[strlen($word)-1] != '"')
@@ -450,6 +457,7 @@
}
}
}
+
return $addresses;
}
--
Gitblit v1.9.1