I’m hoping to use a Python programme to create many subfolders at Runbox. I’ve been trying to get some code to work using the IMAPClient library, with no success.
Here’s what I have: result = server.create_folder('Test')
Works properly - the new folder is visible in Runbox 6, Runbox 7 and Thunderbird.
(Delete folder Test)
Try to create Test plus a chain of subfolders
result = server.create_folder('Test.a.b.c')
No error is reported, but
In Runbox 7, the only new folders are Test and c. C is shown at root level. Test has no subfolders.
In Runbox 6, a new folder called Test.a.b.c is created. Test has no subfolders but is named differently.
In Thunderbird, no new folder is shown.
Environment: IMAPClient 3.0.0, Python 3.12.3
I must be making some sort of fundamental error here, and I would be glad if someone could suggest what it might be.
Using the code result = server.create_folder('Test.a.b.c')
I expected to create four new folders, nested with c inside b, etc.
It seems that the server.create_folder procedure only creates one folder, the last one in the string. All the preceding ones are expected to already exist. So, to create the four folders I wanted, I would have had to do this:
server.create_folder('Test') # creates "Test" at root level
server.create_folder('Test.a') # creates "a" as child of Test
server.create_folder('Test.a.b') # etc
server.create_folder('Test.a.b.c')
Trying to do this in one call to create_folder, when the required folders don’t already exist, surely must be an error, and I feel that an IMAPserver should report this as such. At Runbox the server accepts this call, and this seems to somewhat damage the database as evidenced by the different presentation in Runbox 6 and 7.
The failure of Thunderbird to display the erroneous new folder is a red herring, I believe, related to the general reluctance of Thunderbird to display new folders not created by it.