diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc b/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc
index 152daee4d5ec2d1d74fb3b119f82c1b704143116..8816e39fb5a7657c2b39e98127006b04d3f3d337 100644 (file)
protected function init()
{
mailMethod::init();
- $this->ServerList = $this->config->data['SERVERS']['IMAP'];
+ if(isset($this->config->data['SERVERS']['IMAP'])){
+ $this->ServerList = $this->config->data['SERVERS']['IMAP'];
+ }
}
public function connect()
{
mailMethod::connect();
-
- if (!isset($this->ServerList[$this->MailServer])){
+
+ if(!count($this->ServerList)){
+ $this->error = _("There are no IMAP compatible mail servers defined!");
+ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,
+ "<b>IMAP: No mail servers configured, check systems->server->service->imap.</b>","");
+ return(FALSE);
+ }elseif (!isset($this->ServerList[$this->MailServer])){
$this->error = _("Mail server for this account is invalid!");
@DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,
"<b>IMAP: The selected mail server '".$this->MailServer."' is invalid.</b>","");
And prepare replacements
*/
if(preg_match("/\@/",$this->account_id)){
- $search = preg_replace("/\@/","*@",$this->account_id);
+ $search = preg_replace("/\@/","/*@",$this->account_id);
$with_domain = TRUE;
}else{
- $search = $this->account_id."*";
+ $search = $this->account_id."/*";
$with_domain = FALSE;
}
$folder = $this->account_id;
}
/* Contact imap server */
- $list = @imap_listmailbox($this->imap_handle, $cfg["connect"], $search);
+ $list = @imap_listmailbox($this->imap_handle, $cfg["connect"], $this->account_id);
+ $list2 = @imap_listmailbox($this->imap_handle, $cfg["connect"], $search);
/* Create list of returned folder names */
if (is_array($list)){
+
+ /* Merge in subfolders */
+ if(is_array($list2)){
+ $list = array_merge($list,$list2);
+ }
+
foreach ($list as $val){
$str = trim(preg_replace("/^\{[^\}]*+\}/","",$val));
if($with_domain){
$folders= $this->getMailboxList();
foreach ($folders as $subfolder){
$folder_id = $this->create_folder_id($subfolder);
- echo $folder_id."<br>";
/* Remove all acl's for this folder */
$users= @imap_getacl ($this->imap_handle, $folder_id);