Verified Commit 738781ee authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(cyrus) Fix syntax for subfolders creation

Domain should go at the end

issue #5797
Showing with 11 additions and 1 deletion
+11 -1
...@@ -276,11 +276,21 @@ class mailMethodCyrus extends mailMethod ...@@ -276,11 +276,21 @@ class mailMethodCyrus extends mailMethod
if ($folders !== NULL) { if ($folders !== NULL) {
$cyrus_delim = ($this->cyrusUseSlashes ? '/' : '.'); $cyrus_delim = ($this->cyrusUseSlashes ? '/' : '.');
/* We need to move the domain to the end
* Example: user/john/Drafts@domain.com instead of user/john@domain.com/Drafts
*/
$account = $this->account_id;
$suffix = '';
if (preg_match('/^(.+)(\@[^@]+)$/', $this->account_id, $m)) {
$account = $m[1];
$suffix = $m[2];
}
// Walk thru list of specified folders // Walk thru list of specified folders
foreach ($folders as $folder) { foreach ($folders as $folder) {
@DEBUG(DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, '<b>'.$this->account_id.'</b>', @DEBUG(DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, '<b>'.$this->account_id.'</b>',
'<b>IMAP: Add/Update account folder '.$folder.'</b> on server :'.$this->parent->gosaMailServer); '<b>IMAP: Add/Update account folder '.$folder.'</b> on server :'.$this->parent->gosaMailServer);
if (!imap_createmailbox($this->imap_handle, $cfg['connect'].$this->account_id.$cyrus_delim.$folder)) { if (!imap_createmailbox($this->imap_handle, $cfg['connect'].$account.$cyrus_delim.$folder.$suffix)) {
$this->error = imap_last_error(); $this->error = imap_last_error();
return FALSE; return FALSE;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment