Bug Report: Missing parent folders will cause some clients to not retrieve messages
Morning/Evening All,
This is a general bug report but it applies to most versions of Dovecot that I have tested to date. I tried to find a previous case where something like this has been reported and for the life of me, I can't find one so if I am duplicating an existing bug report - please let me know.
The server platform I am using is FreeBSD 14.1-STABLE (custom build) but that really doesn't have much of a bearing as I was able to recreate the problem on Linux as well as different FreeBSD versions and on different architectures going back as FreeBSD 12 under SPARC).
Dovecot version is dovecot-2.3.21_6, but I have tried earlier versions as well and the behaviour is pretty consistent.
Apple mail versions are multiple, but in the example I put forward below, I am specifically talking about v12.4 which came with OSX 10.14.6 (last release of Mojave). You get the same behaviour out of later versions of Apple mail that come with later relesaes of OSX/MacOS
Thunderbird versions are multiple, but in the example I put forward I am using 115.15.0 (64-bit) under Linux. The behaviour is consistent with earlier versions as well as different platforms (such as Thunderbird on OSX, and Windows).
Description of problem:
When creating subfolders with tools such as imapfilter, if the parent of the subfolder does not exist, Dovecot will allow that folder to be created, and the tool will allow you to populate that folder with messages.
The issue then rears it ugly head when you say use Thunderbird and the messages in this subfolder are not visible. This behaviour is not limited to Thunderbird (e.g. Outlook) but I am using Thunderbird as an example here. Oddly enough, the Apple mail client is *not* impacted in quite the same way (though it is impacted but the behaviour is very subtly different).
Allow me to explain with a practical example as to what is happening, and I will parts of my *actual* config here to highlight the issue.
I have a imapfilter task that routinely archives messages from the likes of "Sent". Easy enough. It takes each message and drops it in an Archives/sent-mail folder with the year as a parent and then inside that is the subfolders of YYYY-MM with the individual months.
So looking at it, it looks something like this:
Archives/sent-mail/YYYY/YYYY-MM
The generated imapfilter rule that is used looks something like this:
sent_202312_bgm = bgm['Sent']:sent_since('01-Dec-2023') * bgm['Sent']:sent_before('01-Jan-2024') sent_202312_bgm:move_messages(bgm['Archives/sent-mail/2023/2023-12'])
This is all pretty simple - if the folder "Archives/sent-mail/2023/2023-12" does not exist it will create it and when done, it will then populate the folder with messages from "Sent".
The issue is that if the "2023" parent folder does not exist, then some mail clients (as identified above - Thunderbird is an example) will never sync that mail.
The workaround is to manually create the YYYY parent folders so that when imapfilter runs and creates the YYYY-MM subfolders then they are visible.
I said that Apple mail is a weird edge case example. Its behaviour is not exactly simple or consistent either when missing parent folders, but you at least get some visual idea that something is wrong.
Screenshots are probably doing going to come across very well in a forum group but allow me to describe what you see in Apple mail. In Apple mail, if the parent folder exists (for example say I use the year 2019), then see the subfolder in a "grey" colour with the name next to it and all is good. This folder *is* visible to Thunderbird and all the Apple mail functionality works.
If the parent folder does *NOT* exist, this is where it gets a little weird. In my example, I have a year of 2023. That parent folder does *NOT* exist. That means that if you look at the Thunderbird view of the Archives/send-mail, you don't see a 2023 parent folder. Apple Mail *DOES* see the parent *BUT* two things are a bit off about it.
#1. When you look at the folder in Apple mail, instead of being grey, it appears as a white colour. You can drill into the folder and see the YYYY-MM subfolders inside, but generally it doesn't appear to "work consistently".
#2. Searches don't work correctly.
Manually renaming the subfolders in Apple mail, then manually creating a parent folder and then moving everything back restores full functionality and also means that other mail clients such as Thunderbird for example will then see all the 2023 subfolders (e.g. 2023-01, 2023-02, etc).
So ... is this a bug in Dovecot? If so ... has it been previously reported and if not, do I get a bug named after me? :P
/BGM
You are not alone with this one! The issue easily occurs with Sieve with "fileinto :create". I have had to use a combination of ugly Sieve and additional server-side fixup scripting via cron to fix this condition.
I have reported it, uh, somewhere. The issue is recognized. I can't tell you what the status is, whether it's labelled as a Dovecot issue or Sieve. Sorry.
Op 9-10-2024 om 01:18 schreef Brendon Meyer via dovecot:
So ... is this a bug in Dovecot? If so ... has it been previously reported and if not, do I get a bug named after me? :P
Does imapfilter make the mailboxes it creates subscribed as well? You can see that in thunderbird.
Regards,
Stephan.
/BGM
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
Thunderbird trips on this scenario. It creates a ghost folder for the parent of a child created with "fileinto :create" simply to display the child, and then complains that the parent is not a folder. This is why I wrote a server-side script to detect and create missing parent folders.
Filters in Thunderbird require the user to select an existing folder. There is no provision for creating a new folder if it doesn't exist.
On 9. Oct 2024, at 2.18, Brendon Meyer via dovecot dovecot@dovecot.org wrote:
When creating subfolders with tools such as imapfilter, if the parent of the subfolder does not exist, Dovecot will allow that folder to be created, and the tool will allow you to populate that folder with messages.
What about trying to reproduce the same with doveadm commands? For example:
doveadm mailbox create -u $user -s testparent4/testchild4/subchild4 echo 'Subject: testmail' | doveadm save -u $user -m testparent4/testchild4/subchild4
The issue then rears it ugly head when you say use Thunderbird and the messages in this subfolder are not visible. This behaviour is not limited to Thunderbird (e.g. Outlook) but I am using Thunderbird as an example here. Oddly enough, the Apple mail client is *not* impacted in quite the same way (though it is impacted but the behaviour is very subtly different).
I tested with the latest Thunderbird in OSX, and I already have similar folders in my Apple Mail. No issues with them other than having to restart Thunderbird for it to see the newly created folders.
What's your doveconf -n output?
participants (4)
-
Brendon Meyer
-
Stephan Bosch
-
Timo Sirainen
-
Tony G