mirror of
https://github.com/LogicLabs-OU/OpenArchiver.git
synced 2026-04-06 00:31:57 +02:00
IMAP emails may have incorrect date when Date header is missing #155
Open
opened 2026-04-05 16:16:47 +02:00 by MrUnknownDE
·
0 comments
No Branch/Tag Specified
main
gh-pages
v0.5.1-dev
v0.4.3-release
ee-legalhold
ee-retention
v0.4.3-dev
wayneshn-patch-1
v0.4.3-pre
v0.4.2-fix
v0.4.2-dev
v0.4.1-dev
mailbox-processing-opt
v0.4.0-fix
ee-init
docs-ocr
v0.3.x-fixes
issue-templates
security-update
create-funding-yml
display-versions
attachment-ocr
docs
user-api-key
demo-mode
v0.3.0
system-settings
wip
CLA-v2
role-based-access
dev
v0.5.0
v0.4.2
v0.4.1
v0.4.0
v0.3.4
v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.1
v0.2.0
v0.1.2
v0.1.1
v0.1.0
Labels
Clear labels
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
documentation
documentation
duplicate
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
good first issue
help wanted
help wanted
help wanted
help wanted
improvement
improvement
question
question
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
MrUnknownDE
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github/OpenArchiver#155
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @prinsss on 10/14/2025
Describe the bug
I found that some emails fetched via IMAP have an incorrect value for the
sent_atfield. Many archived emails have the time when they are fetched as theirSentdate.It seems that we are currently setting the
sent_atfield of an email by parsing its raw content withmailparserand reading theDateheader (see ImapConnector.ts and mail-parser.js). However, not all emails contain aDateheader. In some cases, even theReceivedheader may be absent. This results in fallback tonew Date(), causing inaccurate timestamps.To Reproduce
Steps to reproduce the behavior:
Dateheader.sent_atfield for these emails is set to the current time, not the true received time.👉 Example .eml file
It seems that all emails sent from this address have no Date header. :(
Expected behavior
Emails should have their
sent_atfield set as accurately as possible, even when standard headers are missing.Possible solution
The IMAP protocol provides an
INTERNALDATEvalue for each message, which indicates when the email was received by the server.Using the
internalDatefield provided by theimapflowlibrary as a fallback to theDateheader could help.https://imapflow.com/global.html#FetchMessageObject
Screenshots
Note that all these emails have same sent date. They are actually sent in 2018.
System: