Benoit Tellier created JAMES-4092:
-------------------------------------

             Summary: Mailrepository: filter content
                 Key: JAMES-4092
                 URL: https://issues.apache.org/jira/browse/JAMES-4092
             Project: James Server
          Issue Type: New Feature
          Components: MailStore & MailRepository, webadmin
            Reporter: Benoit Tellier


h2. Why?

Today I was on call with a customer. They screwed up a redirection rule that 
eventually got replicated to James, which dropped / rejected legitimate email 
fluxes.

The intent was to audit content of address-error mail repository, to see if 
some relavant content was there.

This was surpisingly complicated to acheieve. Repository adopt thoussands of 
mails, and I lacked filtering hability to expore this well.

h2. Use cases

As an administrator I want:

 - To list emails in a repository in a given time period
 - To list emails in a repository in matching sender pattern
 - To list emails in a repository in matching recipient pattern
 - From a specific address / host

By applying also to deletions and reprocessing we could do fun things like:

 - Reprocess overquota mails daily over a week
 - But drop them after two week

h2. Api changes

Add url parameters for the filters. They can be combined (logical AND):


{code:java}
curl -XGET /mailRepositories/var%2Fmail%2Ferror%2F/mails?updatedBefore=2d
curl -XGET /mailRepositories/var%2Fmail%2Ferror%2F/mails?updatedAfter=2d
curl -XGET 
/mailRepositories/var%2Fmail%2Ferror%2F/mails?sender=.%2A%40domain.com // curl 
encoded: >*@domain.com
curl -XGET 
/mailRepositories/var%2Fmail%2Ferror%2F/mails?recipient=.%2A%40domain.com // 
url encoded: >*@domain.com
curl -XGET 
/mailRepositories/var%2Fmail%2Ferror%2F/mails?remoteAddress=128.45.67.89
curl -XGET 
/mailRepositories/var%2Fmail%2Ferror%2F/mails?remoteHost=mx.domain.tld
{code}

Apply it also for DELETE:

{code:java}
curl -XDELETE 
/mailRepositories/var%2Fmail%2Ferror%2F/mails?remoteHost=mx.domain.tld
{code}

And for Reprocess All (PATCH):

{code:java}
curl -XPATCH 
127.0.0.1:8000/mailRepositories/var%2Fmail%2Ferror%2F/mails?action=reprocess&processor=transport&remoteHost=mx.domain.tld
{code}






--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
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