Procmail was Mail Delivery Agent that invoked when delivering message to do sorting and filtering. It can be used to put email into different folders based on keywords in from, to, subject, text of the mail.
Procmail use rulesets called recipes to control how an email should be processed. All procmail recipes have three components: flags, conditions, and an action. For complete documentation about the recipies, consults man 5 procmailrc.