]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/include/rcmail.php
Imported Upstream version 0.2.2
[roundcube.git] / program / include / rcmail.php
index f109c16fd9520b4a0b7b6afe2589f7a33cada783..9aad25b2743fb3505063b0538e002d01e79f70bc 100644 (file)
@@ -436,11 +436,13 @@ class rcmail
     if ($a_host['host']) {
       $host = $a_host['host'];
       $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null;
-      $imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : $config['default_port']);
+      if(!empty($a_host['port']))
+        $imap_port = $a_host['port'];
+      else if ($imap_ssl && $imap_ssl != 'tls')
+        $imap_port = 993;
     }
-    else
-      $imap_port = $config['default_port'];
-
+    
+    $imap_port = $imap_port ? $imap_port : $config['default_port'];
 
     /* Modify username with domain if required  
        Inspired by Marco <P0L0_notspam_binware.org>
@@ -453,9 +455,10 @@ class rcmail
         $username .= '@'.$config['username_domain'];
     }
 
-    // try to resolve email address from virtuser table    
-    if (!empty($config['virtuser_file']) && strpos($username, '@'))
-      $username = rcube_user::email2user($username);
+    // try to resolve email address from virtuser table
+    if (strpos($username, '@'))
+      if ($virtuser = rcube_user::email2user($username))
+        $username = $virtuser;
 
     // lowercase username if it's an e-mail address (#1484473)
     if (strpos($username, '@'))