procmail
[Top] [All Lists]

Non-standard Unix delivery (using a database instead of password file!)

1998-06-14 13:31:25
On Wed, 3 Jun 1998 17:49:57 +0100, "John P Connor"
<john(_dot_)connor(_at_)icl(_dot_)net> wrote:
:0:/tmp/viplock
*
DELMAILBOX=| /usr/local/etc/vip_procmail
:0:
*
$DELMAILBOX
<...>
My perl script, vip_procmail, simply outputs the name of the
maildrop and procmail acts on it accordingly.
What I want to do is have DELMAILBOX contain other procmail
commands, such as !, to forward mail to other servers. I've 
tried having the script  output a ! name(_at_)address to no avail.

Special-case it:

    :0:/tmp/viplock
    DELMAILBOX=| /usr/local/etc/vip_procmail

    :0
    * DELMAILBOX ? ^![  ]*\/[^  ].*
    ! $MATCH

    :0:
    $DELMAILBOX

Obviously, something similar could be done with pipes, too, although
you have to jump through more hoops still to handle that. You'd put
this before the unconditional save-to-a-folder recipe, of course:

    :0
    * DELMAILBOX ? ^\|[  ]*\/[^  ].*
    | eval "$MATCH" ;

You don't really need the eval if the MATCH doesn't contain anything
you need the shell to evaluate for you, i.e. it doesn't match
SHELLMETAS. You could check for that separately if you're really keen
on saving cycles.

/* era */

I would get some weird errors from the eval unless I set SHELL=/bin/sh
-- this is always a good idea to have in your .procmailrc anyhow.

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Oops, I still seem to have my old .sig here at home. Ugliness.