1PROCMAILRC(5)                 File Formats Manual                PROCMAILRC(5)
2
3
4

NAME

6       procmailrc - procmail rcfile
7

SYNOPSIS

9       $HOME/.procmailrc
10

DESCRIPTION

12       For a quick start, see NOTES at the end of the procmail(1) man page.
13
14       The  rcfile  can  contain a mixture of environment variable assignments
15       (some of which have special meanings to  procmail),  and  recipes.   In
16       their  most  simple appearance, the recipes are simply one line regular
17       expressions that are searched for in the header of the  arriving  mail.
18       The  first  recipe that matches is used to determine where the mail has
19       to go (usually a file).  If processing falls off the end of the rcfile,
20       procmail will deliver the mail to $DEFAULT.
21
22       There  are two kinds of recipes: delivering and non-delivering recipes.
23       If a delivering recipe is found to match, procmail considers  the  mail
24       (you  guessed  it) delivered and will cease processing the rcfile after
25       having successfully executed the action line of the recipe.  If a  non-
26       delivering recipe is found to match, processing of the rcfile will con‐
27       tinue after the action line of this recipe has been executed.
28
29       Delivering recipes are those that cause header and/or body of the  mail
30       to  be:  written  into  a file, absorbed by a program or forwarded to a
31       mailaddress.
32
33       Non-delivering recipes are: those that cause the output of a program or
34       filter  to  be  captured back by procmail or those that start a nesting
35       block.
36
37       You can tell procmail to treat a delivering recipe as if it were a non-
38       delivering  recipe  by  specifying the `c' flag on such a recipe.  This
39       will make procmail generate a carbon copy of the mail by delivering  it
40       to this recipe, yet continue processing the rcfile.
41
42       By  using  any  number  of  recipes you can presort your mail extremely
43       straightforward into several mailfolders.  Bear in mind though that the
44       mail  can arrive concurrently in these mailfolders (if several procmail
45       programs happen to run at the same time, not unlikely if a lot of  mail
46       arrives).   To  make sure this does not result in a mess, proper use of
47       lockfiles is highly recommended.
48
49       The environment variable assignments and recipes can be  freely  inter‐
50       mixed  in the rcfile. If any environment variable has a special meaning
51       to procmail, it will be used appropriately  the  moment  it  is  parsed
52       (i.e., you can change the current directory whenever you want by speci‐
53       fying a new MAILDIR, switch lockfiles by  specifying  a  new  LOCKFILE,
54       change the umask at any time, etc., the possibilities are endless :-).
55
56       The  assignments  and  substitutions of these environment variables are
57       handled exactly like in sh(1) (that includes all  possible  quotes  and
58       escapes),  with  the  added  bonus  that blanks around the '=' sign are
59       ignored and that, if an environment variable appears without a trailing
60       '=',  it  will  be  removed from the environment.  Any program in back‐
61       quotes started by procmail will have the entire mail at its stdin.
62
63   Comments
64       A word beginning with # and all the following characters up to  a  NEW‐
65       LINE are ignored.  This does not apply to condition lines, which cannot
66       be commented.
67
68   Recipes
69       A line starting with ':' marks the beginning of a recipe.  It  has  the
70       following format:
71
72              :0 [flags] [ : [locallockfile] ]
73              <zero or more conditions (one per line)>
74              <exactly one action line>
75
76       Conditions start with a leading `*', everything after that character is
77       passed on to the internal  egrep  literally,  except  for  leading  and
78       trailing whitespace.  These regular expressions are completely compati‐
79       ble to the normal egrep(1)  extended  regular  expressions.   See  also
80       Extended regular expressions.
81
82       Conditions  are  anded;  if  there are no conditions the result will be
83       true by default.
84
85       Flags can be any of the following:
86
87       H    Egrep the header (default).
88
89       B    Egrep the body.
90
91       D    Tell the internal egrep to distinguish  between  upper  and  lower
92            case (contrary to the default which is to ignore case).
93
94       A    This recipe will not be executed unless the conditions on the last
95            preceding recipe (on the current block-nesting level) without  the
96            `A' or `a' flag matched as well.  This allows you to chain actions
97            that depend on a common condition.
98
99       a    Has the same meaning as the `A' flag, with the  additional  condi‐
100            tion that the immediately preceding recipe must have been success‐
101            fully completed before this recipe is executed.
102
103       E    This recipe only executes if the immediately preceding recipe  was
104            not  executed.  Execution of this recipe also disables any immedi‐
105            ately following recipes with the 'E' flag.   This  allows  you  to
106            specify `else if' actions.
107
108       e    This  recipe  only  executes  if  the immediately preceding recipe
109            failed (i.e., the action line was attempted, but  resulted  in  an
110            error).
111
112       h    Feed the header to the pipe, file or mail destination (default).
113
114       b    Feed the body to the pipe, file or mail destination (default).
115
116       f    Consider the pipe as a filter.
117
118       c    Generate  a  carbon  copy  of this mail.  This only makes sense on
119            delivering recipes.  The only non-delivering recipe this flag  has
120            an  effect on is on a nesting block, in order to generate a carbon
121            copy this will clone the running procmail process (lockfiles  will
122            not be inherited), whereby the clone will proceed as usual and the
123            parent will jump across the block.
124
125       w    Wait for the filter or program to finish and  check  its  exitcode
126            (normally  ignored);  if the filter is unsuccessful, then the text
127            will not have been filtered.
128
129       W    Has the same meaning as the `w' flag, but will suppress any  `Pro‐
130            gram failure' message.
131
132       i    Ignore  any  write  errors on this recipe (i.e., usually due to an
133            early closed pipe).
134
135       r    Raw mode, do not try to ensure the mail ends with an  empty  line,
136            write it out as is.
137
138       There  are  some  special  conditions you can use that are not straight
139       regular expressions.  To select them, the condition must start with:
140
141       !    Invert the condition.
142
143       $    Evaluate the remainder of this condition according to  sh(1)  sub‐
144            stitution  rules  inside  double  quotes, skip leading whitespace,
145            then reparse it.
146
147       ?    Use the exitcode of the specified program.
148
149       <    Check if the total length of the mail is shorter than  the  speci‐
150            fied (in decimal) number of bytes.
151
152       >    Analogous to '<'.
153
154       variablename ??
155            Match  the  remainder  of this condition against the value of this
156            environment variable (which cannot be a pseudo variable).  A  spe‐
157            cial  case  is if variablename is equal to `B', `H', `HB' or `BH';
158            this merely overrides the default header/body search area  defined
159            by the initial flags on this recipe.
160
161       \    To quote any of the above at the start of the line.
162
163   Local lockfile
164       If you put a second (trailing) ':' on the first recipe line, then proc‐
165       mail will use a locallockfile (for this recipe only).  You can  option‐
166       ally  specify  the locallockfile to use; if you don't however, procmail
167       will use the destination filename (or the filename following the  first
168       '>>') and will append $LOCKEXT to it.
169
170   Recipe action line
171       The action line can start with the following characters:
172
173       !      Forwards to all the specified mail addresses.
174
175       |      Starts  the  specified program, possibly in $SHELL if any of the
176              characters $SHELLMETAS are spotted.  You can optionally  prepend
177              this  pipe symbol with variable=, which will cause stdout of the
178              program to be captured in  the  environment  variable  (procmail
179              will not terminate processing the rcfile at this point).  If you
180              specify just this pipe symbol, without any program,  then  proc‐
181              mail will pipe the mail to stdout.
182
183       {      Followed  by  at  least  one space, tab or newline will mark the
184              start of a nesting block.  Everything up till the  next  closing
185              brace  will  depend on the conditions specified for this recipe.
186              Unlimited nesting is permitted.  The closing brace exists merely
187              to delimit the block, it will not cause procmail to terminate in
188              any way.  If the end of a block is reached processing will  con‐
189              tinue  as  usual after the block.  On a nesting block, the flags
190              `H' and `B' only affect the conditions leading up to the  block,
191              the flags `h' and `b' have no effect whatsoever.
192
193       Anything  else  will be taken as a mailbox name (either a filename or a
194       directory,  absolute  or  relative  to  the  current   directory   (see
195       MAILDIR)).   If  it  is a (possibly yet nonexistent) filename, the mail
196       will be appended to it.
197
198       If it is a directory, the mail will be delivered to  a  newly  created,
199       guaranteed  to be unique file named $MSGPREFIX* in the specified direc‐
200       tory.  If the mailbox name ends in "/.", then this  directory  is  pre‐
201       sumed  to  be  an MH folder; i.e., procmail will use the next number it
202       finds available.  If the mailbox name ends in "/", then this  directory
203       is  presumed  to  be  a maildir folder; i.e., procmail will deliver the
204       message to a file in a subdirectory named "tmp" and  rename  it  to  be
205       inside  a  subdirectory named "new".  If the mailbox is specified to be
206       an MH folder or maildir folder,  procmail  will  create  the  necessary
207       directories  if  they  don't  exist, rather than treat the mailbox as a
208       non-existent filename.  When procmail is delivering to directories, you
209       can  specify  multiple  directories  to deliver to (procmail will do so
210       utilising hardlinks).
211
212   Environment variable defaults
213       LOGNAME, HOME and SHELL
214                             Your (the recipient's) defaults
215
216       PATH                  $HOME/bin:/bin:/usr/bin:/sbin:/usr/sbin
217                             :/usr/local/bin:/usr/X11R6/bin (Except during the
218                             processing of an /etc/procmailrc  file,  when  it
219                             will be set to `/bin'.)
220
221       SHELLMETAS            &|<>~;?*[
222
223       SHELLFLAGS            -c
224
225       ORGMAIL               /var/spool/mail/$LOGNAME
226                             (Unless  -m  has been specified, in which case it
227                             is unset)
228
229       MAILDIR               $HOME
230                             (Unless the name of the first successfully opened
231                             rcfile  starts with `./' or if -m has been speci‐
232                             fied, in which case it defaults to `.')
233
234       DEFAULT               $ORGMAIL
235
236       MSGPREFIX             msg.
237
238       SENDMAIL              /usr/sbin/sendmail
239
240       SENDMAILFLAGS         -oi
241
242       HOST                  The current hostname
243
244       COMSAT                no
245                             (If an rcfile is specified on the command line)
246
247       PROCMAIL_VERSION      3.22
248
249       LOCKEXT               .lock
250
251       Other cleared or preset environment variables are IFS, ENV and PWD.
252
253       For security reasons, upon startup procmail will wipe out all  environ‐
254       ment variables that are suspected of modifying the behavior of the run‐
255       time linker.
256
257   Environment
258       Before you get lost in the multitude of environment variables, keep  in
259       mind that all of them have reasonable defaults.
260
261       MAILDIR     Current  directory  while procmail is executing (that means
262                   that all paths are relative to $MAILDIR).
263
264       DEFAULT     Default mailbox file (if not told otherwise, procmail  will
265                   dump  mail  in  this mailbox).  Procmail will automatically
266                   use $DEFAULT$LOCKEXT as lockfile prior to writing  to  this
267                   mailbox.   You  do  not need to set this variable, since it
268                   already points to the standard system mailbox.
269
270       LOGFILE     This file will also contain any error  or  diagnostic  mes‐
271                   sages  from  procmail  (normally none :-) or any other pro‐
272                   grams started by procmail.  If this file is not  specified,
273                   any  diagnostics  or  error messages will be mailed back to
274                   the sender.  See also LOGABSTRACT.
275
276       VERBOSE     You can turn on extended diagnostics by setting this  vari‐
277                   able  to `yes' or `on', to turn it off again set it to `no'
278                   or `off'.
279
280       LOGABSTRACT Just before procmail exits  it  logs  an  abstract  of  the
281                   delivered message in $LOGFILE showing the `From ' and `Sub‐
282                   ject:' fields of the header, what folder it finally went to
283                   and  how  long (in bytes) the message was.  By setting this
284                   variable to `no',  generation  of  this  abstract  is  sup‐
285                   pressed.   If  you  set  it  to `all', procmail will log an
286                   abstract for every successful  delivering  recipe  it  pro‐
287                   cesses.
288
289       LOG         Anything  assigned  to  this  variable  will be appended to
290                   $LOGFILE.
291
292       ORGMAIL     Usually the system mailbox  (ORiGinal  MAILbox).   If,  for
293                   some obscure reason (like `filesystem full') the mail could
294                   not be delivered,  then  this  mailbox  will  be  the  last
295                   resort.   If procmail fails to save the mail in here (deep,
296                   deep trouble :-), then the mail will  bounce  back  to  the
297                   sender.
298
299       LOCKFILE    Global  semaphore file.  If this file already exists, proc‐
300                   mail will wait until it has  gone  before  proceeding,  and
301                   will  create  it  itself  (cleaning  it  up  when ready, of
302                   course).  If more than one lockfile are specified, then the
303                   previous  one  will  be removed before trying to create the
304                   new one.  The use of  a  global  lockfile  is  discouraged,
305                   whenever  possible  use  locallockfiles  (on  a  per recipe
306                   basis) instead.
307
308       LOCKEXT     Default extension that is appended to a destination file to
309                   determine what local lockfile to use (only if turned on, on
310                   a per-recipe basis).
311
312       LOCKSLEEP   Number of seconds procmail will sleep before retrying on  a
313                   lockfile  (if  it  already  existed);  if not specified, it
314                   defaults to 8 seconds.
315
316       LOCKTIMEOUT Number of seconds that have to have passed since a lockfile
317                   was last modified/created before procmail decides that this
318                   must be  an  erroneously  leftover  lockfile  that  can  be
319                   removed  by  force  now.   If zero, then no timeout will be
320                   used and procmail will wait forever until the  lockfile  is
321                   removed;  if  not  specified,  it defaults to 1024 seconds.
322                   This variable is useful to prevent  indefinite  hangups  of
323                   sendmail/procmail.  Procmail is immune to clock skew across
324                   machines.
325
326       TIMEOUT     Number of seconds that have to have passed before  procmail
327                   decides  that  some  child it started must be hanging.  The
328                   offending program will  receive  a  TERMINATE  signal  from
329                   procmail,  and  processing of the rcfile will continue.  If
330                   zero, then no timeout will be used and procmail  will  wait
331                   forever  until  the child has terminated; if not specified,
332                   it defaults to 960 seconds.
333
334       MSGPREFIX   Filename prefix that is used when delivering to a directory
335                   (not used when delivering to a maildir or an MH directory).
336
337       HOST        If  this  is not the hostname of the machine, processing of
338                   the current rcfile will immediately cease. If other rcfiles
339                   were  specified  on  the command line, processing will con‐
340                   tinue with the next one.  If all rcfiles are exhausted, the
341                   program  will  terminate,  but  will  not generate an error
342                   (i.e., to the mailer it will seem that the  mail  has  been
343                   delivered).
344
345       UMASK       The name says it all (if it doesn't, then forget about this
346                   one :-).  Anything assigned to UMASK is taken as  an  octal
347                   number.   If  not specified, the umask defaults to 077.  If
348                   the umask permits o+x, all the mailboxes procmail  delivers
349                   to  directly  will receive an o+x mode change.  This can be
350                   used to check if new mail arrived.
351
352       SHELLMETAS  If any of the characters in SHELLMETAS appears in the  line
353                   specifying  a  filter  or  program, the line will be fed to
354                   $SHELL instead of being executed directly.
355
356       SHELLFLAGS  Any invocation of $SHELL will be like:
357                   "$SHELL" "$SHELLFLAGS" "$*";
358
359       SENDMAIL    If you're not using the  forwarding  facility  don't  worry
360                   about  this  one.  It specifies the program being called to
361                   forward any mail.
362                   It gets invoked as: "$SENDMAIL" $SENDMAILFLAGS "$@";
363
364       NORESRETRY  Number of retries that are to be made if any `process table
365                   full',  `file  table full', `out of memory' or `out of swap
366                   space' error should occur.  If  this  number  is  negative,
367                   then procmail will retry indefinitely; if not specified, it
368                   defaults to 4 times.  The retries  occur  with  a  $SUSPEND
369                   second  interval.   The  idea behind this is that if, e.g.,
370                   the swap space has been exhausted or the process  table  is
371                   full,  usually  several  other  programs will either detect
372                   this as well and abort or crash 8-), thereby freeing  valu‐
373                   able resources for procmail.
374
375       SUSPEND     Number  of  seconds  that  procmail will pause if it has to
376                   wait for something that is currently  unavailable  (memory,
377                   fork,  etc.);  if not specified, it will default to 16 sec‐
378                   onds.  See also: LOCKSLEEP.
379
380       LINEBUF     Length of the internal line buffers, cannot be set  smaller
381                   than 128.  All lines read from the rcfile should not exceed
382                   $LINEBUF characters before and  after  expansion.   If  not
383                   specified,  it  defaults  to  2048.  This limit, of course,
384                   does not apply to the mail itself, which can have arbitrary
385                   line  lengths,  or  could be a binary file for that matter.
386                   See also PROCMAIL_OVERFLOW.
387
388       DELIVERED   If set to `yes' procmail will pretend (to the  mail  agent)
389                   the  mail  has been delivered.  If mail cannot be delivered
390                   after having met this assignment (set to `yes'),  the  mail
391                   will be lost (i.e., it will not bounce).
392
393       TRAP        When  procmail terminates of its own accord and not because
394                   it received a signal, it will execute the contents of  this
395                   variable.   A copy of the mail can be read from stdin.  Any
396                   output produced by this command will be appended  to  $LOG‐
397                   FILE.   Possible  uses  for  TRAP are: removal of temporary
398                   files, logging customised abstracts, etc.  See  also  EXIT‐
399                   CODE and LOGABSTRACT.
400
401       EXITCODE    By  default, procmail returns an exitcode of zero (success)
402                   if it successfully delivered the message  or  if  the  HOST
403                   variable  was  misset and there were no more rcfiles on the
404                   command line; otherwise it returns failure.   Before  doing
405                   so, procmail examines the value of this variable.  If it is
406                   set to a positive numeric value, procmail will instead  use
407                   that  value  as  its exitcode.  If this variable is set but
408                   empty and TRAP is set, procmail will set  the  exitcode  to
409                   whatever the TRAP program returns.  If this variable is not
410                   set, procmail will set it shortly  before  calling  up  the
411                   TRAP program.
412
413       LASTFOLDER  This  variable  is  assigned  to by procmail whenever it is
414                   delivering to a folder or program.  It always contains  the
415                   name  of  the last file (or program) procmail delivered to.
416                   If the last  delivery  was  to  several  directory  folders
417                   together then $LASTFOLDER will contain the hardlinked file‐
418                   names as a space separated list.
419
420       MATCH       This variable is assigned to by  procmail  whenever  it  is
421                   told  to  extract  text from a matching regular expression.
422                   It will contain all text matching  the  regular  expression
423                   past the `\/' token.
424
425       SHIFT       Assigning  a  positive  value to this variable has the same
426                   effect as the `shift' command in sh(1).   This  command  is
427                   most  useful  to extract extra arguments passed to procmail
428                   when acting as a generic mailfilter.
429
430       INCLUDERC   Names an rcfile (relative to the current  directory)  which
431                   will  be  included  here  as if it were part of the current
432                   rcfile.  Nesting is permitted and only limited  by  systems
433                   resources (memory and file descriptors).  As no checking is
434                   done on the permissions or ownership of the  rcfile,  users
435                   of  INCLUDERC should make sure that only trusted users have
436                   write access to the included rcfile or the directory it  is
437                   in.  Command line assignments to INCLUDERC have no effect.
438
439       SWITCHRC    Names  an  rcfile  (relative  to  the current directory) to
440                   which processing will be switched.   If  the  named  rcfile
441                   doesn't  exist or is not a normal file or /dev/null then an
442                   error will be logged and processing will  continue  in  the
443                   current  rcfile.   Otherwise,  processing  of  the  current
444                   rcfile will  be  aborted  and  the  named  rcfile  started.
445                   Unsetting  SWITCHRC aborts processing of the current rcfile
446                   as if it had ended at the assignment.  As  with  INCLUDERC,
447                   no  checking is done on the permissions or ownership of the
448                   rcfile and command line assignments have no effect.
449
450       PROCMAIL_VERSION
451                   The version number of the running procmail binary.
452
453       PROCMAIL_OVERFLOW
454                   This variable will be set to a non-empty value if  procmail
455                   detects  a buffer overflow.  See the BUGS section below for
456                   other details of operation when overflow occurs.
457
458       COMSAT      Comsat(8)/biff(1) notification is on by default, it can  be
459                   turned off by setting this variable to `no'.  Alternatively
460                   the biff-service can be customised by setting it to  either
461                   `service@',  `@hostname',  or `service@hostname'.  When not
462                   specified it defaults to biff@localhost.
463
464       DROPPRIVS   If set to `yes' procmail will drop all privileges it  might
465                   have  had  (suid or sgid).  This is only useful if you want
466                   to guarantee that the bottom half  of  the  /etc/procmailrc
467                   file is executed on behalf of the recipient.
468
469   Extended regular expressions
470       The  following tokens are known to both the procmail internal egrep and
471       the standard egrep(1) (beware that some egrep  implementations  include
472       other non-standard extensions):
473
474       ^         Start of a line.
475
476       $         End of a line.
477
478       .         Any character except a newline.
479
480       a*        Any sequence of zero or more a's.
481
482       a+        Any sequence of one or more a's.
483
484       a?        Either zero or one a.
485
486       [^-a-d]   Any  character which is not either a dash, a, b, c, d or new‐
487                 line.
488
489       de|abc    Either the sequence `de' or `abc'.
490
491       (abc)*    Zero or more times the sequence `abc'.
492
493       \.        Matches a single dot; use \ to quote any of the magic charac‐
494                 ters  to get rid of their special meaning.  See also $\ vari‐
495                 able substitution.
496
497       These were only samples, of course, any  more  complex  combination  is
498       valid as well.
499
500       The following token meanings are special procmail extensions:
501
502       ^ or $    Match a newline (for multiline matches).
503
504       ^^        Anchor  the  expression at the very start of the search area,
505                 or if encountered at the end of the expression, anchor it  at
506                 the very end of the search area.
507
508       \< or \>  Match  the character before or after a word.  They are merely
509                 a shorthand for `[^a-zA-Z0-9_]', but can also match newlines.
510                 Since they match actual characters, they are only suitable to
511                 delimit words, not to delimit inter-word space.
512
513       \/        Splits the expression in two parts.  Everything matching  the
514                 right  part  will  be assigned to the MATCH environment vari‐
515                 able.
516

EXAMPLES

518       Look in the procmailex(5) man page.
519

CAVEATS

521       Continued lines in an action line that specifies a program always  have
522       to  end  in a backslash, even if the underlying shell would not need or
523       want the backslash to indicate continuation.  This is due  to  the  two
524       pass  parsing  process  needed (first procmail, then the shell (or not,
525       depending on SHELLMETAS)).
526
527       Don't put comments on the  regular  expression  condition  lines  in  a
528       recipe, these lines are fed to the internal egrep literally (except for
529       continuation backslashes at the end of a line).
530
531       Leading whitespace on continued regular expression condition  lines  is
532       usually  ignored  (so  that they can be indented), but not on continued
533       condition lines that are evaluated according to the sh(1)  substitution
534       rules inside double quotes.
535
536       Watch  out  for  deadlocks  when doing unhealthy things like forwarding
537       mail to your own account.  Deadlocks can be broken  by  proper  use  of
538       LOCKTIMEOUT.
539
540       Any  default  values  that  procmail has for some environment variables
541       will always override the ones that were already defined.  If you really
542       want  to  override  the  defaults,  you  either have to put them in the
543       rcfile or on the command line as arguments.
544
545       The /etc/procmailrc file cannot change the PATH setting  seen  by  user
546       rcfiles  as  the  value  is reset when procmail finishes the /etc/proc‐
547       mailrc file.  While future enhancements  are  expected  in  this  area,
548       recompiling  procmail with the desired value is currently the only cor‐
549       rect solution.
550
551       Environment variables set inside the shell-interpreted-`|' action  part
552       of  a  recipe will not retain their value after the recipe has finished
553       since they are set in a subshell of procmail.  To make sure  the  value
554       of  an  environment variable is retained you have to put the assignment
555       to the variable before the leading `|' of a recipe, so that it can cap‐
556       ture stdout of the program.
557
558       If you specify only a `h' or a `b' flag on a delivering recipe, and the
559       recipe matches, then, unless the `c' flag is present as well, the  body
560       respectively the header of the mail will be silently lost.
561

SEE ALSO

563       procmail(1), procmailsc(5), procmailex(5), sh(1), csh(1), mail(1),
564       mailx(1), binmail(1), uucp(1), aliases(5), sendmail(8), egrep(1),
565       regexp(5), grep(1), biff(1), comsat(8), lockfile(1), formail(1)
566

BUGS

568       The  only substitutions of environment variables that can be handled by
569       procmail  itself  are  of  the  type  $name,  ${name},   ${name:-text},
570       ${name:+text},  ${name-text}, ${name+text}, $\name, $#, $n, $$, $?, $_,
571       $- and $=; whereby $\name will be substituted by the all-magic-regular-
572       expression-characters-disarmed  equivalent  of $name, $_ by the name of
573       the current rcfile, $- by $LASTFOLDER and $= will contain the score  of
574       the  last  recipe.  Furthermore, the result of $\name substitution will
575       never be split on whitespace.  When the -a or -m options are  used,  $#
576       will  expand  to  the  number  of  arguments so specified and "$@" (the
577       quotes are required) will expand to the specified arguments.   However,
578       "$@" will only be expanded when used in the argument list to a program,
579       and then only one such occurrence will be expanded.
580
581       Unquoted variable expansions performed by procmail are always split  on
582       space, tab, and newline characters; the IFS variable is not used inter‐
583       nally.
584
585       Procmail does not support the expansion of `~'.
586
587       A line buffer of length $LINEBUF is used when  processing  the  rcfile,
588       any  expansions  that don't fit within this limit will be truncated and
589       PROCMAIL_OVERFLOW will be set.  If the overflowing line is a  condition
590       or  an action line, then it will be considered failed and procmail will
591       continue processing.  If it is a variable assignment  or  recipe  start
592       line then procmail will abort the entire rcfile.
593
594       If  the  global lockfile has a relative path, and the current directory
595       is not the same as when the global lockfile was created, then the glob‐
596       al  lockfile will not be removed if procmail exits at that point (reme‐
597       dy: use absolute paths to specify global lockfiles).
598
599       If an rcfile has a relative path and when the rcfile  is  first  opened
600       MAILDIR  contains  a relative path, and if at one point procmail is in‐
601       structed to clone itself and the current directory  has  changed  since
602       the  rcfile  was opened, then procmail will not be able to clone itself
603       (remedy: use an absolute path to reference  the  rcfile  or  make  sure
604       MAILDIR contains an absolute path as the rcfile is opened).
605
606       A  locallockfile  on  the  recipe that marks the start of a non-forking
607       nested block does not work as expected.
608
609       When capturing stdout from a recipe into an environment  variable,  ex‐
610       actly one trailing newline will be stripped.
611
612       Some non-optimal and non-obvious regexps set MATCH to an incorrect val‐
613       ue.  The regexp can be made to work by removing one  or  more  unneeded
614       '*', '+', or '?' operator on the left-hand side of the \/ token.
615

MISCELLANEOUS

617       If the regular expression contains `^TO_' it will be substituted by
618       `(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope
619       |Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)', which should catch
620       all destination specifications containing a specific address.
621
622       If the regular expression contains `^TO' it will be substituted by
623       `(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope
624       |Apparently(-Resent)?)-To):(.*[^a-zA-Z])?)', which should catch all
625       destination specifications containing a specific word.
626
627       If the regular expression contains `^FROM_DAEMON' it will be substitut‐
628       ed by `(^(Mailing-List:|Precedence:.*(junk|bulk|list)|To: Multiple
629       recipients of |(((Resent-)?(From|Sender)|X-Envelope-From):|>?From
630       )([^>]*[^(.%@a-z0-9])?(Post(ma?(st(e?r)?|n)|office)|(send)?Mail(er)?
631       |daemon|m(mdf|ajordomo)|n?uucp|LIST(SERV|proc)|NETSERV|o(wner|ps)
632       |r(e(quest|sponse)|oot)|b(ounce|bs\.smtp)|echo|mirror|s(erv(ices?|er)
633       |mtp(error)?|ystem)|A(dmin(istrator)?|MMGR|utoanswer))(([^).!:a-
634       z0-9][-_a-z0-9]*)?[%@>\t ][^<)]*(\(.*\).*)?)?$([^>]|$)))', which should
635       catch mails coming from most daemons (how's that for a regular
636       expression :-).
637
638       If the regular expression contains `^FROM_MAILER' it will be substitut‐
639       ed by `(^(((Resent-)?(From|Sender)|X-Envelope-From):|>?From
640       )([^>]*[^(.%@a-z0-9])?(Post(ma(st(er)?|n)|office)|(send)?Mail(er)?
641       |daemon|mmdf|n?uucp|ops|r(esponse|oot)|(bbs\.)?smtp(error)?|s(erv(ices?
642       |er)|ystem)|A(dmin(istrator)?|MMGR))(([^).!:a-z0-9][-_a-z0-9]*)?[%@>\t
643       ][^<)]*(\(.*\).*)?)?$([^>]|$))' (a stripped down version of
644       `^FROM_DAEMON'), which should catch mails coming from most mailer-
645       daemons.
646
647       When  assigning  boolean values to variables like VERBOSE, DELIVERED or
648       COMSAT, procmail accepts as true every string starting with: a non-zero
649       value,  `on',  `y', `t' or `e'.  False is every string starting with: a
650       zero value, `off', `n', `f' or `d'.
651
652       If the action line of a recipe specifies a program, a  sole  backslash-
653       newline  pair in it on an otherwise empty line will be converted into a
654       newline.
655
656       The regular expression engine built  into  procmail  does  not  support
657       named character classes.
658

NOTES

660       Since  unquoted  leading  whitespace is generally ignored in the rcfile
661       you can indent everything to taste.
662
663       The leading `|' on the action line to specify a program  or  filter  is
664       stripped before checking for $SHELLMETAS.
665
666       Files included with the INCLUDERC directive containing only environment
667       variable assignments can be shared with sh.
668
669       The current behavior of assignments on the command  line  to  INCLUDERC
670       and  SWITCHRC is not guaranteed, has been changed once already, and may
671       be changed again or removed in future releases.
672
673       For really complicated processing you can even consider  calling  proc‐
674       mail recursively.
675
676       In  the old days, the `:0' that marks the beginning of a recipe, had to
677       be changed to `:n', whereby `n' denotes the number of  conditions  that
678       follow.
679

AUTHORS

681       Stephen R. van den Berg
682              <srb@cuci.nl>
683       Philip A. Guenther
684              <guenther@sendmail.com>
685
686
687
688BuGless                           2001/08/04                     PROCMAILRC(5)
Impressum