Debian Codegraph @

upstream/opensuse-tumbleweed/man5/procmailrc.5

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