EmailSubmission: after local delivery `deliveryStatus.delivered` stays "unknown" and `smtpReply` stays "250 2.1.5 Queued"

Issue Description

A message sent to a mailbox on the same server is delivered within a second, undoStatus becomes final, but deliveryStatus.<rcpt>.delivered is unknown forever and smtpReply keeps the queue reply. Clients cannot show “delivered” even for internal mail, where the server knows the result.

Expected Behavior

RFC 8621, section 7 (deliveryStatus / delivered):

  • "yes": “The message was successfully delivered to the mail store of the recipient. The smtpReply property is final.”
  • "unknown": “The final delivery status is unknown, (e.g., it was relayed to an external machine and no further information is available).”

For a local recipient the final status is known, so after delivery delivered should be "yes" (or "no" on failure) with the final reply.

Actual Behavior

curl -s -u "[email protected]:$PASS1" -H 'Content-Type: application/json' https://mail.example.com/jmap/ -d '{
  "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail", "urn:ietf:params:jmap:submission"],
  "methodCalls": [
    ["Email/set", {"accountId": "c", "create": {"e": {"mailboxIds": {"<drafts>": true}, "keywords": {"$draft": true},
      "from": [{"email": "[email protected]"}], "to": [{"email": "[email protected]"}], "subject": "probe now",
      "bodyValues": {"1": {"value": "probe"}}, "textBody": [{"partId": "1", "type": "text/plain"}]}}}, "e"],
    ["EmailSubmission/set", {"accountId": "c", "create": {"s": {"identityId": "<identity>", "emailId": "#e",
      "envelope": {"mailFrom": {"email": "[email protected]"}, "rcptTo": [{"email": "[email protected]"}]}}}}, "s"]]}'
["EmailSubmission/set", {"accountId": "c", "newState": "ssica", "created": {"s": {"id": "bq",
  "sendAt": "2026-10-21T11:00:04Z", "undoStatus": "pending"}}}, "s"]

The recipient has the message with receivedAt 2026-10-21T11:00:04Z. EmailSubmission/get one second and again 25 seconds later returns the same:

["EmailSubmission/get", {"accountId": "c", "state": "ssica", "list": [{"undoStatus": "final",
  "deliveryStatus": {"[email protected]": {"delivered": "unknown", "smtpReply": "250 2.1.5 Queued",
  "displayed": "unknown"}}, "sendAt": "2026-10-21T11:00:04Z", "id": "bq"}], "notFound": []}, "g"]

Reproduction Steps

The exact requests and responses are under Actual Behavior.

Stalwart Version

v0.16.x

Installation Method

Docker

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

Additional Context

Where it seems to come from:

crates/jmap/src/submission/set.rs stores Delivered::Unknown with “250 2.1.5 Queued” at creation. crates/jmap/src/submission/get.rs overrides it with live per-recipient status (Completed → Yes, PermanentFailure → No) only while the message is still in the queue (read_message_archive(queue_id)). Once the queue entry is removed after delivery, the stored creation-time value is returned again, so the final status is lost. Persisting the final per-recipient status into the EmailSubmission when the queue entry completes (or keeping it until the submission expires) would fix it.

Stalwart v0.16.27, Docker image stalwartlabs/stalwart:v0.16-alpine, default setup from the bootstrap wizard.

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

Your analysis matches what the code actually does. In crates/jmap/src/submission/get.rs, EmailSubmission/get only pulls live per-recipient delivery status from the still-queued message via read_message_archive(queue_id). While the queue entry exists it maps ArchivedStatus::Completed → Delivered::Yes and PermanentFailure → Delivered::No, with the real SMTP reply. But once the message leaves the queue (normal case, seconds after local delivery), that branch is skipped and the code falls back to queued_status = UndoStatus::Final for the submission itself, while the per-recipient delivery_status map simply keeps whatever was stored at creation time in set.rs (Delivered::Unknown, "250 2.1.5 Queued"). Nothing ever rewrites the stored EmailSubmission record with the final per-recipient outcome before the queue entry is purged, so the terminal result is lost even though the server computed it.

This is a genuine gap versus RFC 8621 behavior for local/internal delivery, not a configuration issue, so there’s nothing to adjust on your end to fix it. A staff member will need to look at persisting the final per-recipient status (success/failure + final SMTP reply) into the EmailSubmission object when the queue entry completes, as you suggested.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Fixed in v1.0.0, expected this week.