Imapfilter is one of the more useful email management tools available on Linux. Using Imapfilter, you can connect to remote IMAP mailboxes and perform queries and take actions based on user-customisable filters. Periodically running Imapfilter allows simple processes to be implemented. The commands it is able to perform on a remote mailbox include delete, copy, move, flagging.
An interesting feature of Imapfilter is the capability to maintain connections to multiple IMAP mailboxes at the same time, and take actions between remote mailboxes.
Imapfilter is configured using the Lua programming language and specified in the config.lua file usually located under /home/user/.imapfilter folder.
Some of the example queries that can be sent to an IMAP mailbox include:
For example, using Imapfilter the following activities could be performed:
One potential use case is managing legacy mailboxes: by migrating emails directly using Imapfilter, one can easily avoid the pitfalls of some of the common alternatives. For instance, repeated polling using some webmail solutions can leave original messages behind, decreasing available quota until the mailbox reaches capacity.
Here are some examples of config.lua and further discussion of use cases and example code:
https://fossies.org/linux/imapfilter/samples/config.lua
https://raymii.org/s/blog/Filtering_IMAP_mail_with_imapfilter.html
January 15, 2021