Issue Description
hi, we’re still hitting the Outlook draft issue from this older discussion, now on Stalwart 0.16.14 with Meilisearch.
Outlook APPENDs an autosaved message to Drafts and gets an APPENDUID. It then immediately runs a UID SEARCH. We’ve seen both HEADER Message-ID and 1:* SINCE.
The new UID is already readable with UID FETCH, but that first SEARCH sometimes returns nothing because the external index hasn’t caught up yet. Outlook doesn’t retry. It shows “Outdated Draft / This draft was deleted from another location”, so composing becomes pretty painful.
We have headers enabled in Search.indexEmailFields, so Message-ID search works once indexing catches up. The part that’s still broken is the read-after-write gap.
Expected Behavior
Once APPEND returns APPENDUID, an immediate SEARCH in the same mailbox should be able to find that message, at least for the metadata searches Outlook uses.
Actual Behavior
APPEND succeeds and UID FETCH can see the new message, but an immediate UID SEARCH can return an empty result until Meilisearch indexes the document. Outlook treats that miss as if the draft was deleted.
Reproduction Steps
- Configure Stalwart v0.16.x with Meilisearch. Enable header indexing if testing the Message-ID path.
- IMAP APPEND a new RFC message to Drafts with the \Draft flag.
- Take the UID from APPENDUID and immediately run either:
UID SEARCH HEADER Message-ID "the-message-id"UID SEARCH 1:* SINCE 05-Aug-2026
- Run UID FETCH for the APPENDUID.
- Repeat with no delay between APPEND and SEARCH.
The failure is: SEARCH does not contain the new UID, while UID FETCH already returns it. Each search mode should use its own APPEND so this stays a real single-shot test.
Relevant Log Output
Shortened, sanitized example from our single-shot probe:
C: A1 APPEND "Drafts" (\Draft) {...}
S: A1 OK [APPENDUID 1234 42] APPEND completed
C: A2 UID SEARCH 1:* SINCE 05-Aug-2026
S: * SEARCH
S: A2 OK UID SEARCH completed
C: A3 UID FETCH 42 (UID FLAGS)
S: * 1 FETCH (UID 42 FLAGS (\Draft))
S: A3 OK UID FETCH completed
Stalwart Version
v0.16.x
Installation Method
Docker
Database Backend
PostgreSQL
Blob Storage
S3-compatible
Search Engine
Meilisearch
Directory Backend
Internal
Additional Context
We made a temporary patched build to confirm the cause. For messages appended to Drafts or carrying \Draft, it waits after ingest until the exact account/document ID is visible in the search store before returning APPENDUID. It polls every 25 ms with a 5 second maximum.
That fixed both our single-shot probe and a real Outlook client. When we accidentally ended up back on the stock image, the Outlook dialog came back straight away.
I’m not saying our patch is the right upstream fix, but it confirms the race. Is there a supported way to make this consistent in Stalwart itself? Happy to share the probe and the small patch.
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