procmail
[Top] [All Lists]

Re: match only TO_

2002-04-07 14:04:05
The TO_ macro does a good job of matching any of the possible
ways a mailbox (an address) appears in headers.  Is there a way of testing
whether the address is the only match?

The problem I want to solve is: I want to save everything
sent to  mailing list MFOO(_at_)foo in folder MFOO.
But many things sent to MFOO(_at_)foo are also sent to mailing
list MBAR(_at_)bar,  some are sent to MBAZ(_at_)baz &c.   Have
folders for these lists too & don't want to lose context.

Here is one possibility:

# check if we match any of the possibilities
:0
* ^TO_(mfoo(_at_)foo|mbar(_at_)bar|mbaz(_at_)baz)
{

    # deal with the first posibility, and continue whether or not
    # there is a match
    :0c:
    * ^TO_mfoo(_at_)foo
    foo-box

    # and another
    :0c:
    * ^TO_mbar(_at_)bar
    bar-box

    # and another - don't need the 'c' flag on the last real
    # test
    :0:
    * ^TO_mbaz(_at_)baz
    baz-box

    # and prevent any fall-through
    :0
    /dev/null
}

Hope that helps,
Martin
-- 
Martin McCarthy                 /</    http://procmail.non-prophet.org
    `Procmail Companion'        \>\
     Addison Wesley             /</                  PGP key available
_______________________________________________
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>