In the past, I have written a script using the Python IMAP library to move certain emails in my Gmail Inbox that matched a certain pattern into the SPAM folder.
I would like to set up more rules like, “archive mails from newsletter.com after two weeks”.
Since this seems to be a common use case, I was wondering whether anyone had written a more generic tool to implement rules based email processing. I’m not looking for natural English rules but something a bit easier to configure than writing code.
I’ve used http://fdm.sourceforge.net/ to do this with local mboxes. Section 6.4 of the page I linked says that you can also have an action be on a remote IMAP(S) server.
Mutt also supports connecting directly to an IMAP server and has powerful regex-based tagging and actions based on tags.