I tried it and it worked fine after I set up the alias and did the newaliases command (I called the script test2)
/etc/mail/aliases:
hog: "|/tmp/test2"
The only thing I can think of is that Sendmail won't use a script if it's set up as the 'shell' for an account - it will complain if it's not in /etc/shells. See the FAQ on www.sendmail.org.
This may be it - found on the sendmail.org FAQ -
Q3.34 -- What does "foo not available for sendmail programs" mean?
Date: September 24, 1999
It means that you are using smrsh, the sendmail restricted shell; see Q2.13 for details on this. To fix this problem, you need to create a sym-link from smrsh's directory for restricted programs to the program foo. The default location of this directory for restricted programs is /usr/adm/sm.bin in the Open Source version, but vendor versions differ. For example, RedHat Linux 6.0 uses /etc/smrsh, and Solaris 8 uses /var/adm/sm.bin . If you don't know the directory for your OS, first check the smrsh man page, then if that fails, try:
% strings /path/to/smrsh | grep ^/
where /path/to/smrsh is the P= argument on the Mprog line in sendmail.cf .
So for example:
% cd /usr/adm/sm.bin
% ln -s /usr/bin/vacation
would allow the vacation program to be run from a user's .forward file or an alias which uses the "|program" syntax.
Finally, if you want to disable use of smrsh, remove the FEATURE(`smrsh') line from the .mc file used to build sendmail.cf; see cf/README for details on this.
1) my path was wrong. It should be only the filename in the /etc/aliases file like:
user: "|filename".
2) Also, I had the symlink in the wrong directory. Which I found out was not the /usr/adm/sm.bin that is prescribed for smrsh. Do a man on smrsh for details. Mine is /usr/localcw/bin.
# cd /usr/adm/sm.bin ##or /usr/localcw/bin in my case.
# ln -s /your/script/here . ## yes that is a period to put the link here in the current directory.
After that make sure the file that you are parsing is at least 555 for sendmail to process it. I had mine set to 700 which gave me errors.
Thanks for all the input. I hope this helps someelse in the future!