procmail
[Top] [All Lists]

Re: procmail - a condition .. LOOPING OOPS

2005-01-11 08:31:55
On Tue, Jan 11, 2005 at 01:45:30PM +0000, Andy Heath wrote:
oops - typo in post not in code
(I changed the varname for the post).
(s/WHOFOR/ANDY/).

that bit of code should be:

:0
# if locally deliverable
* |/usr/sbin/sendmail -bv $WHOFOR >/dev/null
# then deliver it
! $WHOFOR(_at_)localhost

Okay, but how about just trying to switch to the putative local
user's .procmailrc and let that save the file; but if there
is no local user with that name, we're still in /etc/procmailrc
and can deal?

You don't really need sed, in any case.  In procmail, try to
think procmail first and solve things natively if possible.

For example, to find the local part of the address in Delivered-To:

   :0
   * ^Delivered-To: \/[^(_at_)]*
   { LOCALNAME = $MATCH }

But even that is unnecessary, because the username is already
known to procmail as $LOGNAME.
       

       :0
       * test -r /path/to/$LOGNAME/.procmailrc
       {
             DROPPRIVS = y
             SWITCHRC         # drop out of /etc/procmailrc
       }


       # if we're still here, $LOGNAME had no .procmailrc,
       # so save mesasge as root


       :0:
       save.$LOGNAME

-- 
dman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail