If it is mail sent to the local user account using MTA using sendmail, you can use procmail to analyze the email as it arrives.
On the system I used, sendmail examined the ~/.forward file, so I had it in ~ username / .forward
# pipe incoming mail to procmail # ref: http:
Then ~username/.procmailrc contains:
# procmail tutorial: http://tldp.org/LDP/LG/issue14/procmail.html PATH=/usr/local/bin:/bin:/usr/bin MAILDIR=$HOME/Mail DEFAULT=$HOME/Mail/inbox LOGFILE=$HOME/procmail.`date +%Y-%m`.log SHELL=/usr/bin/ksh MY_XLOOP='X-Loop: username@hostname.subdomain.example.com ' MY_RECIPIENT=' mailing.list@example.com '
source share