FiltaQuilla replacement


When receiving an e-mail I want to execute a shell script that processes the e-mail and based on the subject and sender perform an action (e.g. “echo $SUBJECT $SENDER”). I know how to talk directly to gmail’s APIs, but I’d rather not do that.

Does anyone have a solution that is workable for this? Preferably something that doesn’t use a lot of system resources.


So… it really depends on your situation.
Is it your system that is receiving the email through smtp? Then probably just feed your mail through procmail. Maybe the .forward-File is supported by your LDA?
If you want to check mail that’s on an imap server, you’ll have to multiple options, for example use mbsync or offlineimap to mirror them and then just look for new files in your local maildir.
You might also be able to find a program that monitors the inbox of a remote imap server and is able to extract the information you want for your script.

Update: you want to avoid procmail, apparently it has security issues. But there should be enough similar tools.


All of the tools you mention are inferior in that they poll, AFAIK.


I do not know something “real-time” and inside Thunderbird but you can
easily setup a python script with imaplib that when a new message arrive
in your inbox (IMAP idle monitored) trigger IMAPFilter. Resource usage
are really low except for two IMAP connection (monitor script +
IMAPFilter when it run) and you have a fully programmable filtering in
lua with a reasonably good builtin library for message matching and

Another, less “real-time” and a little bit more expensive in terms of
resources is sync your mails to a local maildir. Resource side is mostly
a matter of first sync time and disk space used, than you can have the
same py/imaplib monitor script that trigger mbsync (eventually limited
to relevant inbox at first run) and locally process messages with any

To trigger local tools there are plenty of options, mine is notmuch that
can output nearly anything, file path of the (new) message included, or
even inotify-based tools. So, nothing that work out of the box, but not
too complicated or heavy in terms of resources, deps etc, and with the
big plus of having your mail on your system, locally indexed etc. To
sync this setup on many machines in a simple way (so with a single tool
instead of a chain of many) muchsync can grab all messages, tags, …
and replicate bidirectionally.

On GMail a world or warning: IMAP is not standard, you get messages
duplicated (local deduplication with hard link or fs dependent
solution are possible) from “all mail” (localized in your GMail locale)
and any label message have, plus local deletion require many step, in

  • move message to trash
  • sync
  • delete from trash
  • sync again

My personal mail workflow is:

  • IMAPFilter
  • mbsync from multiple IMAP to have anything locally on a home server
  • notmuch (+notmuch-emacs) on home srv
  • muchsync triggered on local desktops against home server
  • K9 on mobile

Not as simple as TB but local message handling is super-comfortable and
an order of magnitude simpler than TB, automatic filtering and message
manipulation are really effective and operate on ANY desktop is a real
pleasure, mobile side it’s limited but having messages filtered by the
home server I still get a clean inbox and I can still see unread
messages on the go outside inbox if I wish. OfflineIMAP direct support
IMAP idle and pre/post sync hooks (and than you can filter and refile
automatically via afew), however IME is buggy and slow that’s why I
switch to mbsync.

Hope that help, sorry for my poor English.

– Ingmar