[KLUG Members] sendmail metacharacters /etc/aliases

Adam Williams members@kalamazoolinux.org
14 Sep 2002 21:54:18 -0400


>Can I use shell metacharacters in an /etc/aliasees file to redirect mail 
>sent to abuse@ to a file?  I want to redirect the each email to abuse@
>to a separate file within a directory.  

If the "to" in the alias begins with a pipe ("|") then it is assumed to
be a script.  SO you can  write a script that reads stdin and deposits
the message somewhere.

freebusy:       | /etc/smrsh/publishfreebusy.sh
[awilliam@estate1 awilliam]$ cat /etc/smrsh/publishfreebusy.sh 
#!/bin/sh
cat > /tmp/freebusy.ifb

You script *MUST* be in smrsh or sendmail will refuse to run it,  this
prevents the execution of arbitrary programs via e-mail.