mirror of
https://github.com/LogicLabs-OU/OpenArchiver.git
synced 2026-04-06 00:31:57 +02:00
Optional deletion of emails from IMAP source after successful archival #48
Open
opened 2026-04-05 16:16:16 +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#48
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 @DanMitrea on 2/6/2026
Problem Statement
When using Open Archiver with a dedicated archive mailbox (e.g., an Exchange mailbox that receives all emails via Transport Rules/BCC), the source mailbox continuously grows since archived emails remain on the IMAP server. This can lead to:
Mailbox quota issues
Increased storage costs
Performance degradation of the mail server
Unnecessary data duplication
Use Case
Many organizations use a dedicated "archive collection mailbox" pattern:
Exchange Transport Rule forwards/BCCs all emails to a dedicated mailbox (e.g., [email protected])
Open Archiver connects via IMAP to retrieve and archive these emails
Once archived, the emails in the source mailbox serve no further purpose and should be removed
This pattern is especially relevant for:
Exchange Server on-premises deployments
Microsoft 365 environments where auto-expanding archives are not available or desired
Organizations wanting to minimize Exchange storage footprint
Proposed Solution
Add an optional configuration setting for IMAP ingestion sources:
Option 1: Environment Variable
envIMAP_DELETE_AFTER_SYNC=true
IMAP_DELETE_RETENTION_DAYS=7 # Optional: keep emails for X days before deletion
Option 2: Per-Source Configuration
Add a toggle in the IMAP source configuration UI:
☐ Delete emails from source after successful archival
Optional: Retention period (days) before deletion
Implementation Details
The feature should:
Only delete emails that have been successfully archived (with confirmed hash storage)
Use IMAP STORE command to mark messages as \Deleted
Execute EXPUNGE to permanently remove flagged messages
Provide audit logging of deletion operations
Include error handling to prevent data loss if archival fails
Optionally: Respect a retention period (e.g., keep emails for 7 days after archival before deletion)
Safety Considerations
Default: OFF - This should be an opt-in feature to prevent accidental data loss
Only apply to IMAP sources (not Google Workspace/M365 Graph API)
Require explicit user confirmation when enabling this option
Log all deletions in the audit trail
Consider a "dry-run" mode to preview what would be deleted
Alternative Workarounds
Currently, users must implement external solutions:
Exchange Retention Policies
Custom PowerShell scripts
Third-party IMAP cleanup tools
A native Open Archiver solution would be cleaner and more reliable.
Related
This is particularly relevant for compliance scenarios where organizations need to:
Maintain a tamper-proof archive (Open Archiver)
Minimize production mail server storage
Ensure complete email capture without journaling complexity