diff --git a/mail/inc/class.mail_bo.inc.php b/mail/inc/class.mail_bo.inc.php index cd4ccc3358..b0bc1f0111 100644 --- a/mail/inc/class.mail_bo.inc.php +++ b/mail/inc/class.mail_bo.inc.php @@ -170,7 +170,7 @@ class mail_bo * not matching the input profileID, if we can not find a profile matching the given ID * @return mail_bo */ - public static function getInstance($_restoreSession=true, $_profileID=0, $_validate=true) + public static function getInstance($_restoreSession=true, &$_profileID=0, $_validate=true) { //$_restoreSession=false; //error_log(__METHOD__.__LINE__.' RestoreSession:'.$_restoreSession.' ProfileId:'.$_profileID.' called from:'.function_backtrace()); @@ -261,7 +261,7 @@ class mail_bo } if (self::$debug) error_log(__METHOD__."($_acc_id) account NOT valid, no imap-host!"); } - catch (egw_exception_not_found $e) { + catch (Exception $e) { unset($e); if (self::$debug) error_log(__METHOD__."($_acc_id) account NOT found!"); } diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php index 568f326655..7670a24029 100644 --- a/mail/inc/class.mail_hooks.inc.php +++ b/mail/inc/class.mail_hooks.inc.php @@ -119,9 +119,15 @@ class mail_hooks $profileID = 0; if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'])) $profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']; + try + { + $mail_bo = mail_bo::getInstance(true,$profileID); + $profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $mail_bo->profileID; + } catch (Exception $ex) { + error_log(__METHOD__."()" . $ex->getMessage()); + $profileID = null; + } - $mail_bo = mail_bo::getInstance(true,$profileID); - $profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $mail_bo->profileID; if($profileID && $mail_bo->openConnection($profileID)) { $folderObjects = $mail_bo->getFolderObjects(true, false); foreach($folderObjects as $folderName => $folderInfo) { @@ -732,9 +738,15 @@ class mail_hooks $profileID = 0; if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'])) $profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']; + try + { + $mail_bo = mail_bo::getInstance(true,$profileID); + $profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $mail_bo->profileID; + } catch (Exception $ex) { + error_log(__METHOD__."()" . $ex->getMessage()); + $profileID = null; + } - $mail_bo = mail_bo::getInstance(true,$profileID); - $profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $mail_bo->profileID; $preferences =& $mail_bo->mailPreferences; $serverCounter = $sieveEnabledServerCounter = 0; if (count($preferences->ic_server)) {