When James receive an email, firstly it's get queue into the mail queue that handle all received SMTP mail. Then it go to the Mailet pipeline after that either it processing worked (mailbox, resent to remote, etc...) either it failed. When the processing of a mail failed, it can bounce (SMTP send a error message to the source) or it get stocked in a mail repository waiting to be deleted or to get re-queue for retry:
On James 2 because file was the only implementation available for the mail queue and the mail repository, it was possible for the user to reprocess failed email by copying them from the mail repository folder into the mail queue folder. But this was a bad practice because it is linked to the file system implementation of the mail queue and the mail repository.
Now that James 3 have multiple implementations, there is no way (except the experimental `FromRepository` mailet) to reprocess failed mails.
We should therefore add some commands to our CLI interface. Here is an overview of the minimum sets of commands that should be done:
- `ReprocessAllMails <repositoryPath>`: it will take all the mails from the repository designed by the given path and move them to the message queue
- `ReprocessMail <repositoryPath> <emailKey>`: it will look for the email having the given key in the repository designed by the repository path and move it to the message queue
- `ListMailRepository` list (by giving paths) all the message repositories
- `ListMailsInRepository <repositoryPath>` list all mails present in a mail repository
- `GetMailInRepository <repositoryPath> <emailKey>`
- `DeleteMailInRepository <repositoryPath> <emailKey>`
- `DeleteMailsInRepository <repositoryPath>`: delete all the mail in the given repository