1Please read the README file in this directory first.
2.ex
3.Id $Id: procmailrc.man,v 1.85 2001/08/04 06:08:21 guenther Exp $
4.TH PROCMAILRC 5 \*(Dt BuGless
5.na
6.SH NAME
7procmailrc \- procmail rcfile
8.SH SYNOPSIS
9.B @PROCMAILRC@
10.ad
11.SH DESCRIPTION
12For a quick start, see
13.B NOTES
14at the end of the
15.BR procmail (1)
16man page.
17.PP
18The rcfile can contain a mixture of environment variable assignments (some
19of which have special meanings to procmail), and recipes.  In their most
20simple appearance, the recipes are simply one line regular expressions
21that are searched for in the header of the arriving mail.  The first recipe
22that matches is used to determine where the mail has to go (usually a file).
23If processing falls off the end of the rcfile, procmail will deliver the mail
24to
25.BR $DEFAULT .
26.PP
27There are two kinds of recipes: delivering and non-delivering recipes.
28If a
29.I delivering recipe
30is found to match, procmail considers the mail (you guessed it) delivered and
31will
32.I cease processing
33the rcfile after having successfully executed the action line of the recipe.
34If a
35.I non-delivering recipe
36is found to match, processing of the rcfile will
37.I continue
38after the action line of this recipe has been executed.
39.PP
40Delivering recipes are those that cause header and/or body of the mail to
41be: written into a file, absorbed by a program or forwarded to a mailaddress.
42.PP
43Non-delivering recipes are: those that cause the output of a program or
44filter to be captured back by procmail or those that start a nesting block.
45.PP
46You can tell procmail to treat a
47.I delivering recipe
48as if it were a non-delivering recipe by specifying the `@CONTINUE@' flag on
49such a recipe.  This will make procmail generate a
50.I carbon copy
51of the mail by delivering it to this recipe, yet continue processing the
52rcfile.
53.PP
54By using any number of recipes you can presort your mail extremely
55straightforward into several mailfolders.  Bear in mind though that the mail
56can arrive concurrently in these mailfolders (if several procmail programs
57happen to run at the same time, not unlikely if a lot of mail arrives).  To
58make sure this does not result in a mess, proper use of lockfiles is highly
59recommended.
60.PP
61The environment variable
62.B assignments
63and
64.B recipes
65can be freely intermixed in the rcfile. If any environment variable has
66a special meaning to procmail, it will be used appropriately the moment
67it is parsed (i.e., you can change the current directory whenever you
68want by specifying a new
69.BR MAILDIR ,
70switch lockfiles by specifying a new
71.BR LOCKFILE ,
72change the umask at any time, etc., the possibilities are endless :\-).
73.PP
74The assignments and substitutions of these environment variables are handled
75exactly like in
76.BR sh (1)
77(that includes all possible quotes and escapes),
78with the added bonus that blanks around the '=' sign are ignored and that,
79if an environment variable appears without a trailing '=', it will be
80removed from the environment.  Any program in backquotes started by procmail
81will have the entire mail at its stdin.
82.PP
83.SS Comments
84A word beginning with # and all the following characters up to a NEWLINE
85are ignored.  This does not apply to condition lines, which cannot be
86commented.
87.SS Recipes
88.PP
89A line starting with ':' marks the beginning of a recipe.  It has the
90following format:
91.Sx 3
92:0 [\fIflags\fP] [ : [\fIlocallockfile\fP] ]
93<zero or more conditions (one per line)>
94<exactly one action line>
95.Ex
96Conditions start with a leading `*', everything after that character
97is passed on to the internal egrep
98.BR literally ,
99except for leading and trailing whitespace.
100These regular expressions are
101.B completely
102compatible to the normal
103.BR egrep (1)
104extended regular expressions.  See also
105.BR "Extended regular expressions" .
106.PP
107Conditions are anded; if there are no conditions the result will be true
108by default.
109.PP
110.I Flags
111can be any of the following:
112.TP 0.5i
113.B @HEAD_GREP@
114Egrep the header (default).
115.TP
116.B @BODY_GREP@
117Egrep the body.
118.TP
119.B @DISTINGUISH_CASE@
120Tell the internal egrep to distinguish between upper and lower case (contrary
121to the default which is to ignore case).
122.TP
123.B @ALSO_NEXT_RECIPE@
124This recipe will not be executed unless the conditions on the last preceding
125recipe (on the current block-nesting level) without the `@ALSO_NEXT_RECIPE@' or
126`@ALSO_N_IF_SUCC@' flag matched as well.  This allows you to chain actions
127that depend on a common condition.
128.TP
129.B @ALSO_N_IF_SUCC@
130Has the same meaning as the `@ALSO_NEXT_RECIPE@' flag, with the additional
131condition that the immediately preceding recipe must have been
132.I successfully
133completed before this recipe is executed.
134.TP
135.B @ELSE_DO@
136This recipe only executes if the immediately preceding recipe was not
137executed.  Execution of this recipe also disables any immediately
138following recipes with the '@ELSE_DO@' flag.  This allows you to specify
139`else if' actions.
140.TP
141.B @ERROR_DO@
142This recipe only executes if the immediately preceding recipe
143.IR failed
144(i.e., the action line was attempted, but resulted in an error).
145.TP
146.B @PASS_HEAD@
147Feed the header to the pipe, file or mail destination (default).
148.TP
149.B @PASS_BODY@
150Feed the body to the pipe, file or mail destination (default).
151.TP
152.B @FILTER@
153Consider the pipe as a filter.
154.TP
155.B @CONTINUE@
156Generate a
157.B carbon copy
158of this mail.  This only makes sense on
159.I delivering
160recipes.  The only non-delivering recipe this flag has an effect on is
161on a nesting block, in order to generate a carbon copy this will
162.B clone
163the running procmail process (lockfiles will not be inherited), whereby
164the clone will proceed as usual and the parent will jump across the block.
165.TP
166.B @WAIT_EXIT@
167Wait for the filter or program to finish and check its exitcode (normally
168ignored); if the filter is unsuccessful, then the text will not have been
169filtered.
170.TP
171.B @WAIT_EXIT_QUIET@
172Has the same meaning as the `@WAIT_EXIT@' flag, but will suppress any
173`Program failure' message.
174.TP
175.B @IGNORE_WRITERR@
176Ignore any write errors on this recipe (i.e., usually due to an early closed
177pipe).
178.TP
179.B @RAW_NONL@
180Raw mode, do not try to ensure the mail ends with an empty line, write
181it out as is.
182.PP
183There are some special conditions you can use that are not straight regular
184expressions.  To select them, the condition must start with:
185.TP 0.5i
186.B !
187Invert the condition.
188.TP
189.B $
190Evaluate the remainder of this condition according to
191.BR sh (1)
192substitution rules inside double quotes, skip leading whitespace,
193then reparse it.
194.TP
195.B ?
196Use the exitcode of the specified program.
197.TP
198.B <
199Check if the total length of the mail is shorter than the specified (in
200decimal) number of bytes.
201.TP
202.B >
203Analogous to '<'.
204.TP
205.B "variablename \fI??\fP"
206Match the remainder of this condition against the value of this environment
207variable (which cannot be a pseudo variable).  A special case is if
208variablename is equal to `B', `H', `HB' or `BH'; this merely overrides the
209default header/body search area defined by the initial flags on this recipe.
210.TP
211.B \e
212To quote any of the above at the start of the line.
213.SS "Local lockfile"
214.PP
215If you put a second (trailing) ':' on the first recipe line, then procmail
216will use a
217.I locallockfile
218(for this recipe only).  You can optionally specify the locallockfile
219to use; if you don't however, procmail will use the destination filename
220(or the filename following the first '>>') and will append $LOCKEXT to it.
221.SS "Recipe action line"
222.PP
223The action line can start with the following characters:
224.TP
225.B !
226Forwards to all the specified mail addresses.
227.TP
228.B |
229Starts the specified program, possibly in $SHELL if any
230of the characters $SHELLMETAS are spotted.  You can optionally prepend this
231pipe symbol with
232.IR variable= ,
233which will cause stdout of the program to be captured in the environment
234.I variable
235(procmail will
236.B not
237terminate processing the rcfile at this point).
238If you specify just this pipe symbol, without any program, then procmail will
239pipe the mail to stdout.
240.TP
241.B {
242Followed by at least one space, tab or newline will mark the start of a
243nesting block.  Everything up till the next closing brace will depend on
244the conditions specified for this recipe.  Unlimited nesting is permitted.
245The closing brace exists merely to delimit the block, it will
246.I not
247cause procmail to terminate in any way.  If the end of a block is reached
248processing will continue as usual after the block.
249On a nesting block, the flags `@HEAD_GREP@' and `@BODY_GREP@' only affect
250the conditions leading up to the block, the flags `@PASS_HEAD@' and
251`@PASS_BODY@' have no effect whatsoever.
252.PP
253Anything else will be taken as a mailbox name (either a filename or a
254directory, absolute or relative to the current directory (see MAILDIR)).
255If it is a (possibly yet nonexistent) filename, the mail will be appended to
256it.
257.PP
258If it is a directory, the mail will be delivered to a newly created,
259guaranteed to be unique file named $MSGPREFIX* in the specified directory.
260If the mailbox name ends in "@MCDIRSEP@@chCURDIR@", then this directory is
261presumed to be an MH folder; i.e., procmail will use the next number it
262finds available.  If the mailbox name ends in "@MCDIRSEP@", then this
263directory is presumed to be a maildir folder; i.e., procmail will deliver
264the message to a file in a subdirectory named "tmp" and rename it to be
265inside a subdirectory named "new".  If the mailbox is specified to be an MH
266folder or maildir folder, procmail will create the necessary directories if
267they don't exist, rather than treat the mailbox as a non-existent
268filename.  When procmail is delivering to directories, you can specify
269multiple directories to deliver to (procmail will do so utilising
270hardlinks).
271.SS "Environment variable defaults"
272.TP 2.2i
273.B "LOGNAME, HOME and SHELL"
274Your (the recipient's) defaults
275.TP
276.B PATH
277.na
278\&@DEFpath@
279(Except
280.ad
281during the processing of an @ETCRC@ file, when it will be set
282to
283.na
284`\&@DEFspath@'.)
285.ad
286.TP
287.B SHELLMETAS
288\&@DEFshellmetas@
289.TP
290.B SHELLFLAGS
291\&@DEFshellflags@
292.TP
293.BR ORGMAIL
294\&@MAILSPOOLDIR@$LOGNAME
295.br
296(Unless
297.B \-@MAILFILTOPT@
298has been specified, in which case it is unset)
299.TP
300.B MAILDIR
301\&@DEFmaildir@
302.br
303(Unless the name of the first successfully opened rcfile starts with
304`@chCURDIR@@MCDIRSEP@' or if
305.B \-@MAILFILTOPT@
306has been specified, in which case it defaults to `@chCURDIR@')
307.TP
308.B DEFAULT
309\&@DEFdefault@
310.TP
311.B MSGPREFIX
312\&@DEFmsgprefix@
313.TP
314.B SENDMAIL
315\&@DEFsendmail@
316.TP
317.B SENDMAILFLAGS
318\&@DEFflagsendmail@
319.TP
320.B HOST
321The current hostname
322.TP
323.B COMSAT
324\&@DEFcomsat@
325.br
326(If an rcfile is specified on the command line)
327.TP
328.B PROCMAIL_VERSION
329\&@PM_VERSION@
330.TP
331.B LOCKEXT
332\&@DEFlockext@@PRESTENV@@LD_ENV_FIX@
333.SS Environment
334.PP
335Before you get lost in the multitude of environment variables, keep in mind
336that all of them have reasonable defaults.
337.TP 1.2i
338.B MAILDIR
339Current directory while procmail is executing (that means that all paths
340are relative to $MAILDIR).
341.TP
342.B DEFAULT
343Default
344.B mailbox
345file (if not told otherwise, procmail will dump mail in this mailbox).
346Procmail will automatically use $DEFAULT$LOCKEXT as lockfile prior to writing
347to this mailbox.  You do not need to set this variable, since it already
348points to the standard system mailbox.
349.TP
350.B LOGFILE
351This file will also contain any error or diagnostic messages from procmail
352(normally none :\-) or any other programs started by procmail.  If this file
353is not specified, any diagnostics or error messages will
354@pconsole@@console@@aconsole@
355See also
356.BR LOGABSTRACT .
357.TP
358.B VERBOSE
359You can turn on
360.I extended diagnostics
361by setting this variable to `yes' or `on', to turn it off again set it to `no'
362or `off'.
363.TP
364.B LOGABSTRACT
365Just before procmail exits it logs an abstract of the delivered message in
366$LOGFILE showing the `@FROM@' and `Subject:' fields of the header, what folder
367it finally went to and how long (in bytes) the message was.  By setting this
368variable to `no', generation of this abstract is suppressed.  If you set
369it to `all', procmail will log an abstract for every successful
370.I delivering recipe
371it processes.
372.TP
373.B LOG
374Anything assigned to this variable will be appended to $LOGFILE.
375.TP
376.B ORGMAIL
377Usually the system mailbox (\fBOR\fPi\fBG\fPinal \fBMAIL\fPbox).  If, for
378some obscure reason (like `\fBfilesystem full\fP') the mail could not be
379delivered, then this mailbox will be the last resort.  If procmail
380fails to save the mail in here (deep, deep trouble :\-), then the mail
381will bounce back to the sender.
382.TP
383.B LOCKFILE
384Global semaphore file.  If this file already exists, procmail
385will wait until it has gone before proceeding, and will create it itself
386(cleaning it up when ready, of course).  If more than one
387.I lockfile
388are specified, then the previous one will be removed before trying to create
389the new one.  The use of a global lockfile is discouraged, whenever possible
390use locallockfiles (on a per recipe basis) instead.
391.TP
392.B LOCKEXT
393Default extension that is appended to a destination file to determine
394what local
395.I lockfile
396to use (only if turned on, on a per-recipe basis).
397.TP
398.B LOCKSLEEP
399Number of seconds procmail will sleep before retrying on a
400.I lockfile
401(if it already existed); if not specified, it defaults to @DEFlocksleep@
402seconds.
403.TP
404.B LOCKTIMEOUT
405Number of seconds that have to have passed since a
406.I lockfile
407was last modified/created before procmail decides that this must be an
408erroneously leftover lockfile that can be removed by force now.  If zero,
409then no timeout will be used and procmail will wait forever until the
410lockfile is removed; if not specified, it defaults to @DEFlocktimeout@ seconds.
411This variable is useful to prevent indefinite hangups of
412.BR sendmail /procmail.
413Procmail is immune to clock skew across machines.
414.TP
415.B TIMEOUT
416Number of seconds that have to have passed before procmail decides that
417some child it started must be hanging.  The offending program will receive
418a TERMINATE signal from procmail, and processing of the rcfile will continue.
419If zero, then no timeout will be used and procmail will wait forever until the
420child has terminated; if not specified, it defaults to @DEFtimeout@ seconds.
421.TP
422.B MSGPREFIX
423Filename prefix that is used when delivering to a directory (not used when
424delivering to a maildir or an MH directory).
425.TP
426.B HOST
427If this is not the
428.I hostname
429of the machine, processing of the current
430.I rcfile
431will immediately cease. If other rcfiles were specified on the
432command line, processing will continue with the next one.  If all rcfiles
433are exhausted, the program will terminate, but will not generate an error
434(i.e., to the mailer it will seem that the mail has been delivered).
435.TP
436.B UMASK
437The name says it all (if it doesn't, then forget about this one :\-).
438Anything assigned to UMASK is taken as an
439.B octal
440number.  If not specified, the umask defaults to @INIT_UMASK@.  If the umask
441permits o+x, all the mailboxes procmail delivers to directly will receive
442an o+x mode change.  This can be used to check if new mail arrived.
443.TP
444.B SHELLMETAS
445If any of the characters in SHELLMETAS appears in the line specifying
446a filter or program, the line will be fed to $SHELL
447instead of being executed directly.
448.TP
449.B SHELLFLAGS
450Any invocation of $SHELL will be like:
451.br
452"$SHELL" "$SHELLFLAGS" "$*";
453.TP
454.B SENDMAIL
455If you're not using the
456.I forwarding
457facility don't worry about this one.  It specifies the program being
458called to forward any mail.
459.br
460It gets invoked as: "$SENDMAIL" $SENDMAILFLAGS "$@";
461.TP
462.B NORESRETRY
463Number of retries that are to be made if any `\fBprocess table full\fP',
464`\fBfile table full\fP', `\fBout of memory\fP' or
465`\fBout of swap space\fP' error should occur.  If this number is negative,
466then procmail will retry indefinitely; if not specified, it defaults to
467@DEFnoresretry@ times.  The retries occur with a $SUSPEND second interval.  The
468idea behind this is that if, e.g., the
469.I swap
470.I space
471has been exhausted or the
472.I process
473.I table
474is full, usually several other programs will either detect this as well
475and abort or crash 8\-), thereby freeing valuable
476.I resources
477for procmail.
478.TP
479.B SUSPEND
480Number of seconds that procmail will pause if it has to wait for something
481that is currently unavailable (memory, fork, etc.); if not specified, it will
482default to @DEFsuspend@ seconds.  See also:
483.BR LOCKSLEEP .
484.TP
485.B LINEBUF
486Length of the internal line buffers, cannot be set smaller than @MINlinebuf@.
487All lines read from the
488.I rcfile
489should not exceed $LINEBUF characters before and after expansion.  If not
490specified, it defaults to @DEFlinebuf@.  This limit, of course, does
491.I not
492apply to the mail itself, which can have arbitrary line lengths, or could
493be a binary file for that matter.  See also PROCMAIL_OVERFLOW.
494.TP
495.B DELIVERED
496If set to `yes' procmail will pretend (to the mail agent) the mail
497has been delivered.  If mail cannot be delivered after having met this
498assignment (set to `yes'), the mail will be lost (i.e., it will not bounce).
499.TP
500.B TRAP
501When procmail terminates of its own accord and not because it
502received a signal, it will execute the contents of this variable.
503A copy of the mail can be read from stdin.  Any output produced by this
504command will be appended to $LOGFILE.  Possible uses for TRAP are: removal
505of temporary files, logging customised abstracts, etc.  See also
506.B EXITCODE
507and
508.BR LOGABSTRACT .
509.TP
510.B EXITCODE
511By default, procmail returns an exitcode of zero (success) if it
512successfully delivered the message or if the
513.B HOST
514variable was misset and there were no more rcfiles on the command
515line; otherwise it returns failure.  Before doing so, procmail
516examines the value of this variable.  If it is set to a positive
517numeric value, procmail will instead use that value as its exitcode.
518If this variable is set but empty and
519.B TRAP
520is set, procmail will set the exitcode to whatever the
521.B TRAP
522program returns.  If this variable is not set, procmail will set
523it shortly before calling up the
524.B TRAP
525program.
526.TP
527.B LASTFOLDER
528This variable is assigned to by procmail whenever it is delivering
529to a folder or program.  It always contains the name of the last file
530(or program) procmail delivered to.  If the last delivery was to
531several directory folders together then $LASTFOLDER will contain
532the hardlinked filenames as a space separated list.
533.TP
534.B @MATCHVAR@
535This variable is assigned to by procmail whenever it is told to extract
536text from a matching regular expression.  It will contain all text
537matching the regular expression past the `\fB\e/\fP' token.
538.TP
539.B SHIFT
540Assigning a positive value to this variable has the same effect as
541the `shift' command in
542.BR sh (1).
543This command is most useful to extract extra arguments passed to procmail
544when acting as a generic mailfilter.
545.TP
546.B INCLUDERC
547Names an rcfile (relative to the current directory) which will be
548included here as if it were part of the current rcfile.  Nesting is
549permitted and only limited by systems resources (memory and file
550descriptors).  As no checking is done on the permissions or ownership
551of the rcfile, users of
552.B INCLUDERC
553should make sure that only trusted users have write access to the included
554rcfile or the directory it is in.  Command line assignments to
555.B INCLUDERC
556have no effect.
557.TP
558.B SWITCHRC
559Names an rcfile (relative to the current directory) to which processing
560will be switched.  If the named rcfile doesn't exist or is not a normal
561file or /dev/null then an error will be logged and processing will
562continue in the current rcfile.  Otherwise, processing of the current
563rcfile will be aborted and the named rcfile started.  Unsetting
564.B SWITCHRC
565aborts processing of the current rcfile as if it had ended at the
566assignment.  As with
567.BR INCLUDERC ,
568no checking is done on the permissions or ownership of the rcfile
569and command line assignments have no effect.
570.TP
571.B PROCMAIL_VERSION
572The version number of the running procmail binary.
573.TP
574.B PROCMAIL_OVERFLOW
575This variable will be set to a non-empty value if procmail detects a
576buffer overflow.  See the
577.B BUGS
578section below for other details of operation when overflow occurs.
579.TP
580.B COMSAT
581.BR Comsat (8)/ biff (1)
582notification is on by default, it can be turned off by setting this variable
583to `no'.  Alternatively the biff-service can be customised by setting it to
584either `service@SERV_ADDRsep@', `@SERV_ADDRsep@hostname', or
585`service@SERV_ADDRsep@hostname'.  When not specified it defaults
586to @COMSATservice@@SERV_ADDRsep@@COMSAThost@.@DROPPRIVS@
587.SS "Extended regular expressions"
588The following tokens are known to both the procmail internal egrep and the
589standard
590.BR egrep (1)
591(beware that some egrep implementations include other non-standard extensions):
592.TP 1.0i
593.B ^
594Start of a line.
595.TP
596.B $
597End of a line.
598.TP
599.B .
600Any character except a newline.
601.TP
602.B a*
603Any sequence of zero or more a's.
604.TP
605.B a+
606Any sequence of one or more a's.
607.TP
608.B a?
609Either zero or one a.
610.TP
611.B [^-a-d]
612Any character which is
613.B not
614either a dash, a, b, c, d or newline.
615.TP
616.B de|abc
617Either the sequence `de' or `abc'.
618.TP
619.B (abc)*
620Zero or more times the sequence `abc'.
621.TP
622.B \e.
623Matches a single dot; use \e to quote any of the magic characters to get
624rid of their special meaning.  See also $\e variable substitution.
625.PP
626These were only samples, of course, any more complex combination is valid
627as well.
628.PP
629The following token meanings are special procmail extensions:
630.TP 1.0i
631\fB^\fP or \fB$\fP
632Match a newline (for multiline matches).
633.TP
634.B ^^
635Anchor the expression at the very start of the search area, or if encountered
636at the end of the expression, anchor it at the very end of the search area.
637.TP
638\fB\e<\fP or \fB\e>\fP
639Match the character before or after a word.  They are merely a shorthand
640for `[^a-zA-Z0-9_]', but can also match newlines.
641Since they match actual characters, they are only suitable to delimit
642words, not to delimit inter-word space.
643.TP
644.B \e/
645Splits the expression in two parts.  Everything matching the right part
646will be assigned to the @MATCHVAR@ environment variable.
647.SH EXAMPLES
648Look in the
649.BR procmailex (5)
650man page.
651.SH CAVEATS
652Continued lines in an action line that specifies a program always have to end
653in a backslash, even if the underlying shell would not need or want the
654backslash to indicate continuation.  This is due to the two pass parsing
655process needed (first procmail, then the shell (or not, depending on
656.BR SHELLMETAS )).
657.PP
658Don't put comments on the regular expression condition lines in a
659recipe, these lines are fed to the internal egrep
660.I literally
661(except for continuation backslashes at the end of a line).
662.PP
663Leading whitespace on continued regular expression condition lines
664is usually ignored (so that they can be indented), but
665.B not
666on continued condition lines that are evaluated according to the
667.BR sh (1)
668substitution rules inside double quotes.
669.PP
670Watch out for deadlocks when doing unhealthy things like forwarding mail
671to your own account.  Deadlocks can be broken by proper use of
672.BR LOCKTIMEOUT .
673.PP
674Any default values that procmail has for some environment variables will
675.B always
676override the ones that were already defined.  If you really want to
677override the defaults, you either have to put them in the
678.B rcfile
679or on the command line as arguments.
680.PP
681The @ETCRC@ file cannot change the PATH setting seen by user rcfiles
682as the value is reset when procmail finishes the @ETCRC@ file.  While
683future enhancements are expected in this area, recompiling procmail
684with the desired value is currently the only correct solution.
685.PP
686Environment variables set
687.B inside
688the shell-interpreted-`|' action part of a recipe will
689.B not
690retain their value after the recipe has finished since they are set in a
691subshell of procmail.  To make sure the value of an environment variable is
692retained you have to put the assignment to the variable before the leading `|'
693of a recipe, so that it can capture stdout of the program.
694.PP
695If you specify only a `@PASS_HEAD@' or a `@PASS_BODY@' flag on a delivering
696recipe, and the recipe matches, then, unless the `@CONTINUE@' flag is
697present as well, the body respectively the header of the mail will be silently
698lost.
699.SH "SEE ALSO"
700.na
701.nh
702.BR procmail (1),
703.BR procmailsc (5),
704.BR procmailex (5),
705.BR sh (1),
706.BR csh (1),
707.BR mail (1),
708.BR mailx (1),
709.BR binmail (1),
710.BR uucp (1),
711.BR aliases (5),
712.BR sendmail (8),
713.BR egrep (1),
714.BR regexp (5),
715.BR grep (1),
716.BR biff (1),
717.BR comsat (8),
718.BR lockfile (1),
719.BR formail (1)
720.hy
721.ad
722.SH BUGS
723The only substitutions of environment variables that can be handled by
724procmail itself are of the type $name, ${name}, ${name:-text}, ${name:+text},
725${name-text}, ${name+text}, $\ename, $#, $n, $$, $?, $_, $\- and $=;
726whereby $\ename will be substituted by the
727all-magic-regular-expression-characters-disarmed
728equivalent of $name, $_ by the name of the current rcfile, $\- by
729$LASTFOLDER and $= will contain the score of the last recipe.
730Furthermore, the result of $\ename substitution will never be split on
731whitespace.  When the
732.B \-@ARGUMENTOPT@
733or
734.B \-@MAILFILTOPT@
735options are used, $# will expand to the number of arguments so
736specified and "$@" (the quotes are required) will expand to the
737specified arguments.  However, "$@" will only be expanded when
738used in the argument list to a program, and
739then only one such occurrence will be expanded.
740.PP
741Unquoted variable expansions performed by procmail are always split on
742space, tab, and newline characters; the IFS variable is not used internally.
743.PP
744Procmail does not support the expansion of `~'.
745.PP
746A line buffer of length $LINEBUF is used when processing the
747.IR rcfile ,
748any expansions that don't fit within this limit will be truncated and
749PROCMAIL_OVERFLOW will be set.  If the overflowing line is a condition
750or an action line, then it will be considered failed and procmail will
751continue processing.  If it is a variable assignment or recipe start
752line then procmail will abort the entire rcfile.
753.PP
754If the global lockfile has a
755.I relative
756path, and the current directory
757is not the same as when the global lockfile was created, then the global
758lockfile will not be removed if procmail exits at that point (remedy:
759use
760.I absolute
761paths to specify global lockfiles).
762.PP
763If an rcfile has a
764.I relative
765path and when the rcfile is first opened
766.B MAILDIR
767contains a relative path, and if at one point procmail is instructed to
768clone itself and the current directory has changed since the rcfile was
769opened, then procmail will not be able to clone itself (remedy: use an
770.I absolute
771path to reference the rcfile or make sure MAILDIR contains an absolute
772path as the rcfile is opened).
773.PP
774A locallockfile on the recipe that marks the start of a non-forking nested
775block does not work as expected.
776.PP
777When capturing stdout from a recipe into an environment variable, exactly
778one trailing newline will be stripped.
779.PP
780Some non-optimal and non-obvious regexps set MATCH to an incorrect
781value.  The regexp can be made to work by removing one or more unneeded
782'*', '+', or '?' operator on the left-hand side of the \e/ token.
783.SH MISCELLANEOUS
784If the regular expression contains `\fB@TO_key@\fP' it will be substituted by
785.na
786.nh
787`\fB@TO_substitute@\fP',
788which should catch all destination specifications containing a specific
789.IR address .
790.hy
791.ad
792.PP
793If the regular expression contains `\fB@TOkey@\fP' it will be substituted by
794.na
795.nh
796`\fB@TOsubstitute@\fP',
797which should catch all destination specifications containing a specific
798.IR word .
799.hy
800.ad
801.PP
802If the regular expression contains `\fB@FROMDkey@\fP' it will be
803substituted by
804.na
805.nh
806`\fB@FROMDsubstitute@\fP',
807which should catch mails coming from most daemons (how's that for a regular
808expression :\-).
809.hy
810.ad
811.PP
812If the regular expression contains `\fB@FROMMkey@\fP' it will be
813substituted by
814.na
815.nh
816`\fB@FROMMsubstitute@\fP'
817(a stripped down version of `\fB@FROMDkey@\fP'),
818which should catch mails coming from most mailer-daemons.
819.hy
820.ad
821.PP
822When assigning boolean values to variables like VERBOSE, DELIVERED or COMSAT,
823procmail accepts as true every string starting with: a non-zero value, `on',
824`y', `t' or `e'.  False is every string starting with: a zero value, `off',
825`n', `f' or `d'.
826.PP
827If the action line of a recipe specifies a program, a sole backslash-newline
828pair in it on an otherwise empty line will be converted into a newline.
829.PP
830The regular expression engine built into procmail does not support named
831character classes.
832.SH NOTES
833Since unquoted leading whitespace is generally ignored in the rcfile you can
834indent everything to taste.
835.PP
836The leading `|' on the action line to specify a program or filter is stripped
837before checking for $SHELLMETAS.
838.PP
839Files included with the INCLUDERC directive containing only environment
840variable assignments can be shared with sh.
841.PP
842The current behavior of assignments on the command line to
843.B INCLUDERC
844and
845.B SWITCHRC
846is not guaranteed, has been changed once already, and may be changed
847again or removed in future releases.
848.PP
849For
850.I really
851complicated processing you can even consider calling
852.B procmail
853recursively.
854.PP
855In the old days, the `:0' that marks the beginning of a recipe, had to
856be changed to `:n', whereby `n' denotes the number of conditions that
857follow.
858