How to run filters and rules on IMAP emails in Android


I need an Android software or script that will run constantly 24/7, connect to the IMAP server of my preferred email provider and run filters/rules on the incoming emails (mainly if subject/body matches a wildcard pattern, then move it to Archive etc).

Is there anything like that?

  1. I do not want to use an Android email client because:
  • I do not want to actually store my emails anywhere else apart from my email provider’s server
  • None seems to offer advanced filtering and rules, most offer either very basic or none
  1. My email provider built-in filtering is very poor as well.
  2. I do not want to use a third-party web service for that (due to risks)
  3. I do not want to use a laptop based solution due to huge costs to run it 24/7

Any idea?


Termux install some Linux script…

Thanks, that ‘linux script’’ got me though, it doesn’t sound like an easy path.

There are several email clients available for Termux. What kind of filtering capabilities they may have I do not know (aerc, Mutt, Alpine, etc.).
There’s a tool called fdm that you could check out to see what it does exactly.

Fdm (mail agent) - Free Software Directory