Imagine a scenario in which you would have to pipe mails to a local user to a php/perl script and you are using Postfix as the MTA . In Postfix this can be setup using procmail as the command for local delivery
==========================
postconf -e ‘mailbox_command = /usr/bin/procmail’
postfix reload
===========================
You should also verify that mail for the root user is forwarded to a user account and run the command newaliases to recreate the aliases hash
Once this is done all local delivery will be done to the command procmail and you can now setup rules in the .procmailrc file in your home directory to pass the mails to a script
The configuration will look something like this:
=====================================================
LOGFILE = $HOME/procmail.log
VERBOSE = yes
# run a program when I get mail
:0
*
| /usr/bin/php /my-beautiful-script.php
======================================================
If there is any problem the first place to look would be the log file procmail.log in your home directory







