I use POPFile, open source software that classifies email into whatever categories you set up using a Bayesian algorithm (so you train it). It works as a proxy so it does it when your download email, so not a solution to your inbox filling up unless your can figure out how to run it on the server automatically.
It tags the email with a header and I use Thunderbird filters to move mail to folders for spam, adverts, political spam, and regular inbox.
It’s abandonware but it still works and doesn’t really need any more features IMO.






I always wonder why I don’t see XMPP mentioned more in conversations like this.