1) Make sure you can reply to emails from your nagios host. This may require sendmail configuration to get it to process email for a particular interface IP.
2) Add an alias in sendmail for the user ID that sends your alerts (mine is nagios@nagioshost)
I added this to /etc/aliases:
I placed my script in /usr/local/bin, but added a symlink to /etc/smrsh. I think this is a sendmail security requirement. The script must be executable by the 'mail' user ID, and 'mail' should be in the 'nagios' group or the script won't be able to write to the command file.
Run the newaliases command to process this change.
3) Create a script to process emails. Mine is shown in the next reply, but it is far from perfect!