procmail
[Top] [All Lists]

Re: 'vacation' usage

1996-07-23 09:35:10
Ralph Finch asked,

| I wish to use the vacation example in procmailex.  I have a few
| separate filters that put useful mail into $DEFAULT, that I would like
| to use vacation for.  My question is, do I replace each $DEFAULT line
| with the several 'vacation' filter lines in procmailex?

If you're using a version of procmail recent enough to understand braces
and the INCLUDERC directive (and I guess braces came later, so if it
understands brace nesting you're ok), you'll probably want to do it the
following way instead of being concerned about having multiple copies of
the same code and making sure that any change you make to it is carried
through to every copy.

Every recipe before the end that saves to $DEFAULT, simply change from

  :0[condition flags][action flags, of which there probably are none]:
  * conditions
  $DEFAULT

to 

  :0[condition flags]
  * conditions
  { INCLUDERC=$HOME/.vacationrc }

or you could make it $MAILDIR/.vacationrc, or wherever, but be sure that
it is named by a full path (or a variable that expands to a full path).

Then put this code into the .vacationrc file:

  :0[flags]c
  | vacation_routine

  :0:
  $DEFAULT

If you make any changes to the vacation routine, you'll need to edit only
.vacationrc, and moreover you won't have your .procmailrc bloated with mul-
tiple copies of the vacation routine.

If some of these kinds of mail shouldn't be treated exactly like the others,
you can set a variable, like this:

  :0[condition flags]
  * conditions
  { TYPE=gribbleplotz INCLUDERC=/wher/ev/er/.vacationrc }

and then the code inside .vacationrc can act according to the contents (or
emptiness) of $TYPE.

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