procmail
[Top] [All Lists]

Re: Procmail filter for outgoing mail

1997-06-24 07:22:00
Chris Bidmead <bidmead(_at_)cbidmead(_dot_)demon(_dot_)co(_dot_)uk> writes:
On Tue, 24 Jun 97 I (Chris Bidmead) wrote:
Thanks very much for that swift response, Philip. I've rejigged my
filter so it looks like this:

=====cut here=========

Sorry, I missed the vital first line of my outgoing procmail  
filter, which is the hash-bang bit.  Here's the whole thing again:

=====cut here=========
#! /usr/local/bin/procmail
# This filter is called proctest
SHELL=/bin/sh
# for diagnostics
TMPDIR=/tmp/procmailtest
VERBOSE=yes
LOGFILE=$TMPDIR/procmail.log

:0f
* ^To:.*Mag-Reader
| formail -I "Reply-To: 
chris-unix(_at_)cbidmead(_dot_)demon(_dot_)co(_dot_)uk" -s
{ }

:0
| /Users/bidmead/stopthatmail "$@"

=====cut here=========

<smack>  I've got it!  When you invoke the above by typing

        proctest dummy(_at_)address(_dot_)to(_dot_)test < TestMailItem

the kernel invokes procmail like this:

        procmail /path/to/proctest dummy(_at_)address(_dot_)to(_dot_)test < 
TestMailItem

(Well, the redirection would already be done.)  The problem is that
procmail only treats additional arguments as items to stuff into $@
if they are each preceeded by a "-a", or if procmail was passed the
"-m" flag to put it in mailfilter mode.  Otherwise, procmail thinks
you're specifying an additional procmailrc named 
"dummy(_at_)address(_dot_)to(_dot_)test"

Solution?  Change the #! line to read:

        #! /usr/local/bin/procmail -m


Philip Guenther