[
https://issues.apache.org/jira/browse/JAMES-3758?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17531527#comment-17531527
]
Karsten Otto commented on JAMES-3758:
-------------------------------------
Regarding sanitation, that is what the mailet does. It looks like this:
{code:java}
<mailet match="All" class="Expires">
<minAge>1d</minAge> <!-- used if existing expires header is
less than this -->
<defaultAge>30d</defaultAge> <!-- used if there is no expires header
yet -->
<maxAge>90d</maxAge> <!-- used if existing expires header is
more than this -->
</mailet>{code}
But of course, if an admin does not configure this mailet, the delete task has
no Expires header to work with. So an additional task or strategy for removing
mails by internal date makes sense too.
Currently the task uses MessageManager.search() with
SearchQuery.headerDateBefore("Expires", ...), but could easily use
SearchQuery.internalDateBefore() as well for fixed date expiration.
Also, it only affects INBOXes; in my experience, this is where mails tend to
pile up, and will benefit from automatic deletion. I was assuming that when
people sort mails into other folders, they usually want to keep them.
Finally, I have not tested this with large mail sets, so cannot really tell
about performance.
I am pretty swamped right now, but I'll try to create a PR of what I have next
week.
> Endpoint to delete emails older than X days/months/years
> --------------------------------------------------------
>
> Key: JAMES-3758
> URL: https://issues.apache.org/jira/browse/JAMES-3758
> Project: James Server
> Issue Type: Improvement
> Components: mailbox, webadmin
> Affects Versions: 3.7.0
> Reporter: Benoit Tellier
> Priority: Major
>
> An often requested feature is to have a data cleaup mechanism to delete old
> emails.
> We can easily implement such a task in webadmin-mailbox.
> For instance:
> {code:java}
> curl -XDELETE /messages?olderThan=1year
> {code}
> Would plan a task to delete emails older than a year accross all accounts. It
> will return the count of deleted emails.
> As one of my customer is interested by this feature I might work on this.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]