Dovecot supports SAVEDATE IMAP extension [1]. This is however not implemented correctly for Maildir storage.
Compared to "internal date", "save date" is supposed to be the same but well-defined for APPEND and preserved when COPY command is used.
However, for Maildir storage INTERNALDATE is implemented using mtime (modification timestamp) and SAVEDATE is implemented using ctime (status change timestamp) [2]. ctime is changed even more often than mtime. For example, chown or chmod operations on the message change its ctime, but preserve its mtime.
Dovecot should instead use btime (creation timestamp) when it is available and not implement SAVEDATE at all if there is no btime.
Just one example of the message in Maildir:
stat 1708031310.M769290P3712350.nine,S=7898,W=8002:2,Sa File: 1708031310.M769290P3712350.nine,S=7898,W=8002:2,Sa Size: 7898 Blocks: 16 IO Block: 4096 regular file Device: 9,2 Inode: 7864351 Links: 1 Access: (0600/-rw-------) Uid: ( 999/ vmail) Gid: ( 996/ vmail) Access: 2024-02-16 08:34:04.374097798 +0100 Modify: 2024-02-15 22:08:30.769813368 +0100 Change: 2024-02-21 13:39:14.878163244 +0100 Birth: 2024-02-15 22:08:30.769813368 +0100
Its Birth date (btime) and Modify date (mtime) are the same, but Change date (ctime) was changed, likely by someone doing chown/chmod manually.
You can read more in the issue [3] where we have problems with incorrect INTERNALDATE and investigated the possibility of using SAVEDATE, but found that it is not implemented correctly and is changed even more often than INTERNALDATE. According to the standard it should be the other way round, SAVEDATE should be more stable and survive COPY.
[1] https://www.rfc-editor.org/rfc/rfc8514.html [2] https://github.com/dovecot/core/blob/93eb0663336b17f66a67324de43e64bf0bc796c... [3] https://github.com/deltachat/deltachat-core-rust/issues/5339