Stalwart ignores default special-use folder settings when creating new users

Issue Description

When I set default folders in /admin/Settings/x:Email/EmailDefaults and then create a new user account, Stalwart ignores the names I have given the folders and creates them with the standard names anyway.

In my case, I set a default folders with “create automatically” and “subscribe automatically” set to ON:

Role | Name
Inbox | Inbox
Junk | Spam
Trash | Trash
Drafts | Drafts
Sent | Sent

Expected Behavior

The folders are created with the names I gave, and these can be seen when logging in as the new user and going to /account/Account/Mailbox:

Role | Name
Inbox | Inbox
Junk | Spam
Trash | Trash
Drafts | Drafts
Sent | Sent

Actual Behavior

The folders are created with default names, and my settings are ignored:

Role | Name
Inbox | Inbox
Junk | Junk Mail
Trash | Deleted Items
Drafts | Drafts
Sent | Sent Items

Reproduction Steps

  1. Configure Stalwart with the above default email folders
  2. Create a new user account
  3. Log in as the new user account
  4. Click on Mailboxes

Relevant Log Output

I cannot find anything in the logs, and I cannot find how to set the logging level to trace (it would be a good idea to have this instruction in the form :slight_smile:

Stalwart Version

v0.16.x

Installation Method

Docker

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

Additional Context

I will upload the images as a reply, as this form does not appear to allow image attachments.

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

Let me research how default folder settings work in Stalwart, particularly around user creation and special-use mailboxes.

I found the issue in the source code. This is a confirmed bug. Here’s what’s happening:

The default_folders configuration is read correctly from your settings, but the server configuration (EmailConfig) is only parsed at startup (via Bootstrap::parse). This means changes made to defaultFolders through the admin UI are not picked up until the server restarts.

More specifically, looking at crates/common/src/config/mailstore/email.rs, the EmailConfig::parse() method runs once at boot time. When you save new settings in the admin panel, those values are persisted to the database, but the in-memory self.core.email.default_folders that create_system_folders() uses (in crates/email/src/mailbox/manage.rs) does not get refreshed dynamically.

The fix/workaround: After saving your defaultFolders settings in the admin panel, restart the Stalwart server. Once restarted, newly created users should get the folder names you configured (e.g. “Spam” instead of “Junk Mail”, “Trash” instead of “Deleted Items”, “Sent” instead of “Sent Items”).

If restarting does not fix it (i.e. the config reload path still reads stale defaults), this is a genuine bug that needs a code-level fix – a human maintainer will be able to confirm this.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong. If you found it useful, mention @helpbot in any reply to ask follow-up questions and the bot will respond again.

Admin configuration: Email > Defaults

Expected result

Actual result

@helpbot Restarting the server fixes the issue. However, I’d still consider it a bug that either the change is not reflected immediately (preferred behaviour) or the need to restart for the changes to be read is documented at IMAP and POP3 | Stalwart and in the edit UI.