diff --git a/emailadmin/inc/class.defaultimap.inc.php b/emailadmin/inc/class.defaultimap.inc.php index 8fdef22bff..2a73a60e68 100644 --- a/emailadmin/inc/class.defaultimap.inc.php +++ b/emailadmin/inc/class.defaultimap.inc.php @@ -277,17 +277,22 @@ class defaultimap extends Net_IMAP /** * Create transport string * + * @param string $host - you may overwrite classvar + * @param string $_encryption - you may overwrite classvar * @return string the transportstring */ - function _getTransportString() + function _getTransportString($host = null, $_encryption = null) { - if($this->encryption == 2) { - $connectionString = "tls://". $this->host; - } elseif($this->encryption == 3) { - $connectionString = "ssl://". $this->host; + if ($this->debug && $_encryption) error_log(__METHOD__.__LINE__.'->'.$host.', '.$_encryption); + $encryption = $this->encryption; + if ($_encryption) $encryption = $_encryption; + if($encryption == 2) { + $connectionString = "tls://". ($host?$host:$this->host); + } elseif($encryption == 3) { + $connectionString = "ssl://". ($host?$host:$this->host); } else { // no tls - $connectionString = $this->host; + $connectionString = ($host?$host:$this->host); } return $connectionString; @@ -296,19 +301,23 @@ class defaultimap extends Net_IMAP /** * Create the options array for SSL/TLS connections * + * @param string $_encryption - you may overwrite classvar * @return string the transportstring */ - function _getTransportOptions() + function _getTransportOptions($_encryption = null) { + if ($this->debug && $_encryption) error_log(__METHOD__.__LINE__.'->'.$_encryption); + $encryption = $this->encryption; + if ($_encryption) $encryption = $_encryption; if($this->validatecert === false) { - if($this->encryption == 2) { + if($encryption == 2) { return array( 'tls' => array( 'verify_peer' => false, 'allow_self_signed' => true, ) ); - } elseif($this->encryption == 3) { + } elseif($encryption == 3) { return array( 'ssl' => array( 'verify_peer' => false, @@ -317,14 +326,14 @@ class defaultimap extends Net_IMAP ); } } else { - if($this->encryption == 2) { + if($encryption == 2) { return array( 'tls' => array( 'verify_peer' => true, 'allow_self_signed' => false, ) ); - } elseif($this->encryption == 3) { + } elseif($encryption == 3) { return array( 'ssl' => array( 'verify_peer' => true, diff --git a/emailadmin/inc/class.emailadmin_sieve.inc.php b/emailadmin/inc/class.emailadmin_sieve.inc.php index 09e395847c..9691917c71 100644 --- a/emailadmin/inc/class.emailadmin_sieve.inc.php +++ b/emailadmin/inc/class.emailadmin_sieve.inc.php @@ -106,10 +106,11 @@ class emailadmin_sieve extends Net_Sieve $this->_timeout = 10; // socket::connect sets the/this timeout on connection $timeout = felamimail_bo::getTimeOut('SIEVE'); if ($timeout>$this->_timeout) $this->_timeout = $timeout; - - if(PEAR::isError($this->error = $this->connect($sieveHost , $sievePort, null, $useTLS) ) ){ - if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.": error in connect($sieveHost,$sievePort): ".$this->error->getMessage()); - $isConError[$_icServerID] = "SIEVE: error in connect($sieveHost,$sievePort): ".$this->error->getMessage(); + $options = $_icServer->_getTransportOptions(($sievePort==5190?3:1)); + $sieveHost = $_icServer->_getTransportString($sieveHost,($sievePort==5190?3:1)); + if(PEAR::isError($this->error = $this->connect($sieveHost , $sievePort, $options, $useTLS) ) ){ + if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.": error in connect($sieveHost,$sievePort, ".array2string($options).", $useTLS): ".$this->error->getMessage()); + $isConError[$_icServerID] = "SIEVE: error in connect($sieveHost,$sievePort, ".array2string($options).", $useTLS): ".$this->error->getMessage(); egw_cache::setCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isConError,$expiration=60*15); return false; }