procmail
[Top] [All Lists]

Re: several recipients configuration

1998-08-22 00:25:54
At 11:41 PM 8/21/98 +0300, Liviu Daia wrote:
On 21 August 1998, Florian Koch <koch(_at_)agua(_dot_)de> wrote:
Hello

I want to configure my .procmailrc file to handle several recipients
corresponding to the TO field.

[snip]

   I'm not sure I fully understand what you want, but:

[snip]

(2) If you want messages to _both_ Hans and Michael to get to both
   addresses instead of being swallowed by the rules for either Hans
   alone or Michael alone:

      # messages to both Hans and Michael
      :0
      * ^TO_hans
      * ^TO_michael
      ! hans(_at_)another(_dot_)domain1 michael(_at_)another(_dot_)domain2

      # messages to Hans alone
      :0
      * ^TO_hans
      ! hans(_at_)another(_dot_)domain1

      # messages to Michael alone
      :0
      * ^TO_michael
      ! michael(_at_)another(_dot_)domain2

In general, you will be better off using the "c" flag for
such things; in this case:

        # unset in case a previous recipe set LASTFOLDER:
        LASTFOLDER

        :0c
        * ^TO_hans
        ! hans(_at_)another(_dot_)domain1

        :0c
        * ^TO_michael
        ! michael(_at_)another(_dot_)domain2

        # now trash the mail if either or both of those delivered
        :0
        LASTFOLDER ?? .
        /dev/null

Since they are both three recipes, why bother?  Well, if you add a third
name, the first technique will need 7 recipes, but the second, just 4.

(Optimization detail... you can leave the c flag off the last
recipe in such a list, provided you're careful when editing the list.)

Note that what it looks like Florian is really trying to do, can't be
done correctly with procmail (see the FAQ) since the actual destination
of mail doesn't always appear in the RFC822 headers (e.g., mailing lists,
Bcc'd mail, and of course, SPAM).

Cheers,
Stan

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