Example of mail redirection with procmail.

1. Go to your home directory (execute  "cd").
2. Create file .qmail
3. Put the following lines

./Mailbox
|preline /usr/local/bin/procmail

4. Remark: the first line is needed while you are setting up the filtering. If filtering works you'll see two copies of regular mail in your Mailbox.
5. Create file .procmailrc
6. Put the following lines in .procmailrc

LOGFILE=${HOME}/.procmail.log
VERBOSE=off
ORGMAIL=${HOME}/Mailbox
DEFAULT=${HOME}/Mailbox

:0
* ^From.*money@yahoo\.com
/dev/null
:0
* ^From.*monkey
/dev/null


7. Execute "chmod 600 .procmailrc".
8. Send a e-mail to yourself. If you see two copies of your message then you can safely delete the first line ( ./Mailbox ) from the .qmail.
9. The example above will delete the mail from money@yahoo.com and from account  monkey. There are a lot more things you can do with incoming mail e.g. you can redirect (to some folder or delete ) mail depending on the content of its From, To, Subject fields. See more examples in this procmail tutorial .

Important Procmail is very powerful and can be a dangerous tool.  It must be used carefully or it can easily lose large amounts of mail.  Run several tests before using procmail!