]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/include/rcube_smtp.php
Imported Debian patch 0.5.2+dfsg-1
[roundcube.git] / program / include / rcube_smtp.php
index b3db9d22955d275d4c39df9b034ba4b47c80342e..817eef8aa7c2d322ae70d4692ab66bd78a3afa0e 100644 (file)
@@ -15,7 +15,7 @@
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
 
- $Id: rcube_smtp.php 4123 2010-10-22 19:16:45Z alec $
+ $Id: rcube_smtp.php 4666 2011-04-17 09:34:02Z alec $
 
 */
 
@@ -101,11 +101,11 @@ class rcube_smtp
       $helo_host = 'localhost';
 
     // IDNA Support
-    $smtp_host = idn_to_ascii($smtp_host);
+    $smtp_host = rcube_idn_to_ascii($smtp_host);
 
     $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
@@ -118,6 +118,13 @@ class rcube_smtp
       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']);
     $smtp_pass = str_replace('%p', $RCMAIL->decrypt($_SESSION['password']), $CONFIG['smtp_pass']);
     $smtp_auth_type = empty($CONFIG['smtp_auth_type']) ? NULL : $CONFIG['smtp_auth_type'];
@@ -132,8 +139,9 @@ class rcube_smtp
     if ($smtp_user && $smtp_pass)
     {
       // IDNA Support
-      if (strpos($smtp_user, '@'))
-        $smtp_user = idn_to_ascii($smtp_user);
+      if (strpos($smtp_user, '@')) {
+        $smtp_user = rcube_idn_to_ascii($smtp_user);
+      }
 
       $result = $this->conn->auth($smtp_user, $smtp_pass, $smtp_auth_type, $use_tls, $smtp_authz);