ddeboer / imap

Object-oriented, fully tested PHP IMAP library
MIT License
889 stars 253 forks source link

getMailboxes() is trying to open a non-mailbox folder resulting in a "cannot reopen" error. #569

Closed jerrac closed 10 months ago

jerrac commented 10 months ago
Q A
ddeboer/imap version 1.19.0
PHP version 8.2
IMAP provider Personal Dovecot server

Summary

Running getMailboxes() fails.

Current behavior

When running getMailboxes(), it errors with a "cannot reopen" message.

How to reproduce: code & error stack trace

Where $connection is a working connection, this code results in the following error:

$mailboxes = $connection->getMailboxes();
In ImapResource.php line 61:

  Cannot reopen mailbox "dovecot.sieve"                                                                                         
  imap_alerts (0):                                                                                                              
  imap_errors (1):                                                                                                              
  - [SERVERBUG] Internal error occurred. Refer to server log for more information. [2023-12-29 15:33:58] (0.001 + 0.000 secs). 

Expected behavior

There is no dovecot.sieve mailbox. So the getMailboxes() method should not be trying to open it.

The only dovecot.sieve in the authenticated account is a symlink.

lrwxrwxrwx    1 2000 2000      23 Jan 11  2023  .dovecot.sieve -> 'sieve/main script.sieve'

Solution?

So, after digging into the php code a bit, I couldn't see where it would be responsible for detecting if a mailbox was actually a symlink to a file. I'm 90% certain that is actually up to the IMAP server itself. Dovecot in my case.

So, for some reason I think Dovecot is reporting a symlink to my sieve script as a mailbox.

Which means the solution is to make Dovecot not do that.

I'm posting this here just in case someone down the road hits the same issue I did.

jerrac commented 10 months ago

Since this isn't an actual bug, I'm closing this now.