Invalid `receivedAt` returned by `Email/get` after `Email/import`
### Discussed in https://github.com/stalwartlabs/stalwart/discussions/2891
<div type='discussions-op-text'>
<sup>Originally posted by **s-aga-r** March 5, 2026</sup>
### Issue Description
When importing an email via JMAP `Email/import`, the message is created successfully. However, fetching the message using `Email/get` returns an invalid `receivedAt` value far in the future.
Example:
```text
receivedAt: 32491-03-20T02:52:16Z
```
### Expected Behavior
The `receivedAt` should reflect the actual delivery/received timestamp, and should not be an invalid future date.
### Actual Behavior
_No response_
### Reproduction Steps
### 1. Import email
- Request:
```json
{
"using": ["urn:ietf:params:jmap:mail"],
"methodCalls": [
[
"Email/import",
{
"accountId": "mh",
"emails": {
"e0": {
"blobId": "edomwfnvxq9jwcqph0d27tfbgo1nhud72121evyp7bfc22uxjvj1jbyd13kkltig",
"mailboxIds": {"a": true},
"keywords": {"$seen": true}
}
}
},
"0"
]
]
}
```
- Response:
```json
{
"methodResponses": [
[
"Email/import",
{
"accountId": "mh",
"oldState": "s2iea",
"newState": "s2mea",
"created": {
"e0": {
"id": "cdiaaaaq2",
"threadId": "q7",
"blobId": "cdomwfnvxq9jwcqph0d27tfbgo1nhud72121evyp7bfc22uxjvj1jbydacoai",
"size": 26484
}
}
},
"0"
]
],
"sessionState": "3e25b2a0"
}
```
### 2. Fetch the created email
- Request:
```json
{
"using": ["urn:ietf:params:jmap:mail"],
"methodCalls": [
[
"Email/get",
{
"accountId": "mh",
"ids": ["cdiaaaaq2"],
"properties": [
"id",
"blobId",
"threadId",
"mailboxIds",
"keywords",
"size",
"receivedAt",
"sentAt",
"hasAttachment",
"subject",
"preview",
"from",
"to",
"cc",
"bcc",
"replyTo",
"sender",
"messageId",
"inReplyTo",
"references",
"htmlBody",
"textBody",
"bodyValues",
"attachments"
],
"fetchAllBodyValues": true
},
"0"
]
]
}
```
- Response (truncated):
```json
{
"methodResponses": [
[
"Email/get",
{
"accountId": "mh",
"state": "s2qea",
"list": [
{
"id": "cdiaaaaq2",
"blobId": "cdomwfnvxq9jwcqph0d27tfbgo1nhud72121evyp7bfc22uxjvj1jbydacoai",
"threadId": "q7",
"mailboxIds": {"a": true},
"keywords": {"$seen": true},
"size": 26484,
"receivedAt": "32491-03-20T02:52:16Z",
"sentAt": "2025-04-14T18:45:18Z",
"hasAttachment": false,
"subject": "...",
"preview": "...",
"from": [...],
"to": [...],
"htmlBody": [...],
"textBody": [...],
"bodyValues": {
"2": {"value": "..."},
"3": {"value": "..."}
},
"attachments": []
}
],
"notFound": []
},
"0"
]
],
"sessionState": "3e25b2a0"
}
```
### Relevant Log Output
_No response_
### Stalwart Version
v0.15.x
### Installation Method
Docker
### Database Backend
MySQL
### Blob Storage
S3-compatible
### Search Engine
Elasticsearch
### Directory Backend
Internal
### Additional Context
Example MIME Message:
```text
Delivered-To: <redacted@domain>
Return-Path: <redacted@domain>
Received: by smtp-host-1 with SMTP id <id>;
Mon, 14 Apr 2025 12:35:23 -0700 (PDT)
Received: by smtp-host-2 with SMTP id <id>;
Mon, 14 Apr 2025 12:35:23 -0700 (PDT)
Received: from smtp-host-3 (smtp-host-3 [x.x.x.x])
by mx-host with SMTPS id <id>
for <redacted@domain>;
Mon, 14 Apr 2025 12:35:23 -0700 (PDT)
Received: by smtp-host-4 with SMTP id <id>;
Mon, 14 Apr 2025 12:35:22 -0700 (PDT)
Received: by smtp-host-5 with SMTP id <id>;
Mon, 14 Apr 2025 12:35:21 -0700 (PDT)
Received: by smtp-host-6 with SMTP id <id>;
Mon, 14 Apr 2025 12:35:20 -0700 (PDT)
Received: from mail-origin-host (mail-origin-host [x.x.x.x])
by mx-host with ESMTPS id <id>
(version=TLS1_3 cipher=<cipher> bits=256/256);
Mon, 14 Apr 2025 12:35:20 -0700 (PDT)
Date: Mon, 14 Apr 2025 18:45:18 +0000
Message-Id: <redacted@host>
From: <Sender Name> <redacted@domain>
To: <redacted@domain>
Reply-To: <redacted@domain>
Subject: <redacted>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="boundary-1"
DKIM-Signature: v=1; a=rsa-sha256; d=<redacted-domain>; s=<selector>; ...
ARC-Seal: i=1; a=rsa-sha256; d=<redacted-domain>; s=<selector>; ...
ARC-Message-Signature: i=1; a=rsa-sha256; d=<redacted-domain>; s=<selector>; ...
ARC-Authentication-Results: mx-host; dkim=pass; spf=pass; dmarc=pass
Authentication-Results: mx-host;
dkim=pass header.i=@<redacted-domain>;
spf=pass smtp.mailfrom=<redacted@domain>;
dmarc=pass header.from=<redacted-domain>
Received-SPF: pass (mx-host: domain of sender permitted sender)
Precedence: list
List-ID: <list.redacted>
List-Post: <mailto:list@domain>
List-Help: <mailto:list-help@domain>
List-Archive: <https://example/list/archive>
List-Unsubscribe: <mailto:list-unsubscribe@domain>
X-Mailer-System: <redacted>
X-Custom-Notification: <notification>
```
### I acknowledge that:
- [X] I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.
- [X] I have searched the Stalwart repository (both open and closed Discussions and Issues) and confirm this is not a duplicate.
- [X] I have set the logging level to `trace` and included relevant log output if applicable.
- [X] I agree to follow the project's [Code of Conduct](https://github.com/stalwartlabs/.github/blob/main/CODE_OF_CONDUCT.md).</div>
关闭于 2026-04-23 1 条评论