procmail
[Top] [All Lists]

Re: multiple actions for a procmail rule

2001-04-22 20:38:14
Aaron asked,

| hi. is it possible for a procmail rule to execute multiple actions?

Generally, no; to do that one uses a `c' flag within braces or a `c' flag and
an `A' flag; see the procmailrc(5) and procmailex(5) man pages.

| ie. send/forward to 2 email addresses?

That can be done in one action:

 :0 flags
 * conditions
 ! ad(_at_)dre(_dot_)ss1 ad(_at_)dre(_dot_)ss2

|     or having 2 pipes to 2 separate commands?

That requires two recipes, but with use of braces or an `A' flag the
conditions can be tested only once.  For examples,

 :0c other_flags
 * conditions1
 action1
  :0A action_related_flags
  action2

or

 :0 condition-related_flags
 * conditions
 {
  :0c other_action_related_flags
  action1

  :0 action_related_flags
  action2
 }

A lot of posts here are cases where people didn't read or ask first, wrote
code like this,

 # THIS IS WRONG.  DO NOT DO THIS.
 :0
 * conditions
 action1
 action2

and were baffled that only action1 was carried out and that in some cases
they also got an error in their logs from action2.

_______________________________________________
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>