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