Here's a good howto on incoming mail processing. The simplese thing to do is to use the
.forward mechanism as described, to pipe a message through a script. Create a mode 600 .forward file in the user's home directory and put a pipe to a script in it:
"|$HOME/bin/your.program -and some arguments"
However, you should look at using procmail instead, as that howto details. Procmail gives you a lot of advantages, such as more sophisticated logging and mail processing. Here's a simple .procmailrc example (again from that same howto):
* !^X-Loop: email@example.com
which has some nice features, like the ability to detect and stop mail loops.