Filter and move emails with is a set of perl scripts that can help you to automate filtering emails. The script(s) can run in cron on a regular basis.

First you need to download, unpack and install the scripts some place on your server.

Then, you have to create a rule.txt file which might contain several lines. For example:

From    "Cron *"        Inbox   Trash
Subject    "*error message *"     Inbox   Trash
From    "" Inbox   Trash

This rule.txt file will filter the Inbox folder, and move the emails matching to Trash.
Important: The field separator is a Tab in the rule.txt file. Normal space would not work. Hint: use vim-editor, and press the tab-key on your keyboard.

In order to filter your messages, you apply this command:

./bin/ -S -r rule.txt

By making many rules in different text files, you can run many different filter jobs on your Inbox and other mailboxes if you wish, on your IMAP server(s), on different dates and time.

For instance:

Every day you could run an automated job that would delete all Trash emails at 17:00 when you finish work (cron jobs, advertising, and so on).
And every end of the month, you can filter out your colleagues emails, and store them in a IMAP folder called WORKPEOPLE for instance.