email – Decent CLI utility for managing filtering rules for iCloud Mail on Ubuntu Server 20.04

So I recently switched to iCloud from Gmail due to wanting to de-Googlefy myself for privacy reasons.

There’s been a few adjustments, but one I haven’t been able to work around is how Rules for filtering emails only run if the host macOS device is running the Mail app at the time the email is received.

There is a server-side utility available for iCloud Rules, but it’s severely limited compared to what is available on macOS Mail. One of my biggest use cases for Rules is to forward Amazon order confirmations to different members of my family, as we share one Prime account. Doing this necessitates looking at both the sender (to determine it’s Amazon) and the message content (to determine who placed the order). The server-side iCloud Rules do not allow for multiple conditions.

TL;DR FROM THIS POINT

Since I have a local always-up host running Ubuntu Server 20.04, I was wondering if there’s a decent utility for managing these Rules here instead? It doesn’t need to be at all intuitive for viewing emails, it just needs to be simple enough to set up filters of this nature and continuously run in the background.

Any advice or pointers would be greatly appreciated!