mail filter

A program which sorts and processes incoming mail based on patterns found in the mail headers.

procmail is an example for Unix.