[imp] Namespace issues with Courier (was "How to set the IMAP path prefix in horde webmail 5.2?")

Quinn Comendant quinn at strangecode.com
Tue Feb 9 17:50:30 UTC 2016


Perhaps this report would be more appropriate for the horde dev list?

Quinn


Quoting Quinn Comendant <quinn at strangecode.com>:

> An update…
>
> Quoting Quinn Comendant <quinn at strangecode.com>:
>
>> Does anybody know how to set the IMAP path prefix in the latest   
>> horde/imp? I'm getting the error when creating folders, "The  
>> mailbox  'Sent' was not created. This is what the server said: IMAP  
>> error  reported by server."
>
>
> I believe the correct method of setting the IMAP path prefix is to   
> define the following in backends.local.php:
>
>     'namespace' => array('INBOX.'),
>
> However, that alone has not solved the problem. I may have found   
> issues with horde/imp or our server configuration. Now, even with  
> the  namespace specified thusly, IMP is still sending IMAP commands  
> without  the namespace (i.e., "CREATE Sent" instead of "CREATE  
> INBOX.Sent").
>
> I have read the source code of horde/imp and found the following   
> changes were required for this to work:
>
> ## /var/www/html/horde/imp/lib/Imap.php : 474
>
> The `getNamespace()` function defined here would return null when  
> the  specified mailbox was the default, despite  
> `$this->getNamespaces()`  returning a valid result. To solve this I  
> added the following at line  474:
>
>     if ($mailbox === self::NS_DEFAULT && $ns->count() == 1) {
>         return end(end($ns));
>     }
>
> ## /usr/share/pear/Horde/Imap/Client/Base.php : 742
>
> Here, the name of the namespace is an array and would result in an   
> array-to-string conversion, with the resulting namespace name  
> "Array"  instead of the correct name "INBOX". I've added a tertiary  
> clause to  test if it is an array before assigning the value.  
> Secondly, the  namespace name lacking the delimiter would result in  
> the use of folder  names such as "INBOXSent" instead of "INBOX.Sent"  
> (because in other  parts of the code where the namespace is used the  
> namespace is  concatenated with the folder name with no delimiter),  
> so I added the  delimiter to the name here. The following is a  
> modification of line 742:
>
>     $ob->name = (is_array($val) ? end($val) : $val) . $val['delimiter'];
>
> With these two changes, horde/imp is now successfully creating   
> folders, displaying folders, auto-creating special folders, and  
> moving  messages between folders.
>
> If I have discovered bugs in horde/imp 5.2, please let me know how   
> best I can contribute these changes (pull request on github?) or if   
> you  believe this is a problem with my Courier IMAP configuration, I  
>  would appreciate some help identifying if that may be the case.
>
> Attached is IMP's imap log output during a successful folder  
> creation  operation (also so you can see imap capabilities, etc).
>
> Regards,
> Quinn





More information about the imp mailing list