Sieve
Sieve is a programming language that can be used for email filtering. It owes its creation to the CMU Cyrus Project, creators of Cyrus IMAP server.
The language is not tied to any particular operating system or mail architecture. It requires the use of RFC 2822-compliant messages, but otherwise should generalize to other systems that meet these criteria. The current version of Sieve’s base specification is outlined in RFC 5228, published in January 2008.
More information at: https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)