procmail
[Top] [All Lists]

Re: Procmail matching multiple rules, executing last one...why?

2001-10-24 15:49:24
On Mon, Oct 22, 2001 at 04:22:54PM -0700, Jason Luros wrote:
It was my understanding that procmail exits as soon as a match is made.
However, it appears from my logs that it matches and then continues to check
the other rules and executes the last match it finds. Could someone take a
look at this and tell me if I'm missing something? I have placed --> arrows
on the multiple rule matches in the log below. TIA.

I haven't identified why it's doing what you think it's doing (or even if it's
doing it), but you can DRASTICLY simplfy your procmailrc.


SHELL=/usr/local/bin/bash

I'd suggest you use sh instead of bash.

VERBOSE=yes
LOGABSTRACT=all 
MAILDIR=$HOME/Mail
PMDIR=$HOME/.procmail
LOCKFILE=$PMDIR/.lockmail
LOGFILE=$PMDIR/log
INCLUDERC=$PMDIR/rc.listserv

:0 B:
* unsubscribe solaris-test.*
! listserv

:0 B:
* unsubscribe fw-1-mailinglist.*
* ^TO_fw-1-mailinglist(_at_)(_dot_)*
! listserv

:0 B:
* unsubscribe fw-1-mailinglist-test.*
* ^TO_fw-1-mailinglist-test(_at_)(_dot_)*
! listserv

The last three can be simplified thus:

:0 B:
* unsubscribe (solaris-test|fw-1-mailinglist(-test)?)
!listserv

The tests for ^TO_ would seem rather redundant here.

:0 BH:
* is on vacation
* ^TO_fw-1-mailinglist(_at_)(_dot_)*
! owner-fw-1-mailinglist

:0 BH:
* out of the office
* ^TO_fw-1-mailinglist(_at_)(_dot_)*
! owner-fw-1-mailinglist

:0 BH:
* out of office
* ^TO_fw-1-mailinglist(_at_)(_dot_)*
! owner-fw-1-mailinglist

:0 BH:
* is on vacation
* ^TO_fw-1-mailinglist-test(_at_)(_dot_)*
! owner-fw-1-mailinglist

:0 BH:
* out of the office
* ^TO_fw-1-mailinglist-test(_at_)(_dot_)*
! owner-fw-1-mailinglist

:0 BH:
* out of office
* ^TO_fw-1-mailinglist-test(_at_)(_dot_)*
! owner-fw-1-mailinglist

These can be simplified as

:0BH:
* (on vacation|out of (the)? office)
!owner-fw-1-mailinglist

:0:
* ^TO_solaris-test(_at_)(_dot_)*
! solaris-test-remailer

:0:
# Since you're not matching a specific address, but a certain word in the
# address, use the word-match instead.
* ^TOsolaris-test
!solaris-test-remailer

:0:
* ^TO_fw-1-mailinglist(_at_)(_dot_)*
! fw-1-mailinglist-remailer

Ditto here.

:0:
* ^TO_fw-1-mailinglist-test(_at_)(_dot_)*
! fw-1-mailinglist-test-remailer

And here.

:0:
* ^FROM_DAEMON
! bouncbot

Might want to add loop checks in these recipes as well.

With these, your entire procmailrc would look more like:

SHELL=/usr/bin/sh
VERBOSE=yes
LOGABSTRACT=all 
MAILDIR=$HOME/Mail
PMDIR=$HOME/.procmail
LOCKFILE=$PMDIR/.lockmail
LOGFILE=$PMDIR/log
INCLUDERC=$PMDIR/rc.listserv

:0 B:
* unsubscribe (solaris-test|fw-1-mailinglist(-test)?)
!listserv

:0BH:
* (on vacation|out of (the)? office)
!owner-fw-1-mailinglist

:0:
* ^TOsolaris-test
!solaris-test-remailer

:0:
* ^TOfw-1-mailinglist
!fw-1-mailinglist-remailer

:0:
* ^TOfw-1-mailinglist-test
!fw-1-mailinglist-test-remailer

:0:
* ^FROM_DAEMON
* ! ^X-Loop: bouncebot(_at_)yourdomain(_dot_)tld
| formail -A'X-Loop: bouncebot(_at_)yourdomain(_dot_)tld' -A'To: bouncebot' | \
        $SENDMAIL -oi -t

-- 
Andrew Edelstein        -       andrew(_at_)pure-chaos(_dot_)com
http://andrew.pure-chaos.com

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>