[ 
https://issues.apache.org/jira/browse/JAMES-3758?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17531500#comment-17531500
 ] 

Benoit Tellier commented on JAMES-3758:
---------------------------------------

Hello Karsten,

Sorry for the long delay for the answer. I spent a bit of time to think about 
it.

 - Having a mailet to be configured for this approach to work creates in my 
opinion complexity. It requires users to configure it upfront in order to get 
the Expires header, which could be missed. Then what to do with emails without 
those headers? 
 - Using headers to convey information for further processing can create 
"vulnerabilities", if the headers are not properly sanitized. A user could set 
the Expires header to an arbitrary value and defeat the retention policy if an 
unaware admin don't properly sanitize such headers at the entry of the system.
 - Finally, such a strategy would require reading headers of all emails which 
might come up at an expensive cost for large datasets.

IMO, we need a simpler strategy than Expires headers but both could cohabit.
For  instance: 

{code:java}
curl -XDELETE /messages?olderThan=1year
{code}

Would rely on the internal date

And:

{code:java}
curl -XDELETE /messages?usingExpiracyHeader=Expires
{code}

Could cohabit.

We could have a `RetentionStrategy` interface that provides the messages to be 
deleted, and we could implement two Retention Strategies, and keep most of the 
code in common.


> 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: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to