procmail
[Top] [All Lists]

Re: several recipients configuration

1998-08-22 11:21:14
On 22 August 1998, Stan Ryckman <stanr(_at_)sunspot(_dot_)tiac(_dot_)net> wrote:
[...]
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,

    Yes, the joy of procmail not having an OR operator.  For "N"
recipients you would need 2^N-1 recipes with my approach (which actually
emulates the truth table for OR). :-)

but the second, just 4.
[...]

    That would be N+1 recipes. :-)

    Ok, now that I think of it, it could probably be further enhanced
by collecting just the addresses at the first N recipes, and bouncing
the message at the N+1st recipe to all final recipients.  In fact, David
Tamkin just posted a message illustrating this technique a few days ago,
I'll attach it below.

    Regards,

    Liviu

-- 
Dr. Liviu Daia                   e-mail:   daia(_at_)stoilow(_dot_)imar(_dot_)ro
Institute of Mathematics         web page: http://www.imar.ro/~daia
of the Romanian Academy          PGP key:  finger 
daia(_at_)stoilow(_dot_)imar(_dot_)ro
--- Begin Message ---
Walter Haiding wrote,

| Is there some kind of "postprocess" rule/command with is run after all
| mails are processed by procmail? I do not remember reading of such at all.

That's what procmail's TRAP variable is for.  It says what procmail should do
on the way out after delivery.

| Yes. I'd like to have several sendmails processing a single mail on after
| the other. The only problem is that they're run concurrently.

I don't understand.  Why must the same exact message be sent separately to
all its forwardees?  Can't you use one recipe to send it to all of them and
thus invoke sendmail only once for each message that you forward?

If you need to run several recipes to determine exactly which people should
be sent the message, save the results in variables and then, at the end of
them, use one forwarding recipe.  For example,

  FORWARD JOE SHEILA MARTHA CRAIG

  :0 # plus condition-modifying flags
  * reasons to forward to Joe
  { JOE="Joe's address" FORWARD=yes }

  :0 # plus condition-modifying flags
  * reasons to forward to Sheila
  { SHEILA="Sheila's address" FORWARD=yes }

  :0 # plus condition-modifying flags
  * reasons to forward to Martha
  { MARTHA="Martha's address" FORWARD=yes }

  :0 # plus condition-modifying flags
  * reasons to forward to Craig
  { CRAIG="Craig's address" FORWARD=yes }

  :0 # add `c' flag to forward a copy and keep original 
  * FORWARD ?? yes
  ! $JOE $SHEILA $MARTHA $CRAIG

--- End Message ---
<Prev in Thread] Current Thread [Next in Thread>