Debian Codegraph @

upstream/opensuse-tumbleweed/man1/procmail.1

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 PROCMAIL 1 \*(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 procmail \- autonomous mail processor
50 .SH SYNOPSIS
51 .B procmail
52 .RB [ \-ptoY ]
53 .RB [ "\-f \fIfromwhom\fP" ]
54 .if n .ti +0.5i
55 .RI [ "parameter\fB=\fPvalue " | " rcfile" ]
56 \&.\|.\|.
57 .br
58 .B procmail
59 .RB [ \-toY ]
60 .RB [ "\-f \fIfromwhom\fP" ]
61 .RB [ "\-a \fIargument\fP" ]
62 \&.\|.\|.
63 .if n .ti +0.5i
64 .B \-d
65 .I recipient
66 \&.\|.\|.
67 .br
68 .B procmail
69 .RB [ \-ptY ]
70 .B \-m
71 .RI [ "parameter\fB=\fPvalue" ]
72 \&.\|.\|.
73 .I rcfile
74 .if n .ti +0.5i
75 .RI [ argument ]
76 \&.\|.\|.
77 .br
78 .B procmail
79 .RB [ \-toY ]
80 .RB [ "\-a \fIargument\fP" ]
81 .B \-z
82 .br
83 .B procmail
84 .B \-v
85 .ad
86 .SH DESCRIPTION
87 For a quick start, see
88 .B NOTES
89 at the end.
90 .PP
91 .B Procmail
92 should be invoked automatically over the
93 .B .forward
94 file mechanism as soon as mail arrives. Alternatively, when installed by
95 a system administrator, it can be invoked from within the mailer immediately.
96 When invoked, it first sets some environment variables to default values,
97 reads the mail message from stdin until an EOF, separates the body from the
98 header, and then, if no command line arguments are present, it starts to look
99 for a file named
100 .BR $HOME/.procmailrc .
101 According to the processing recipes in this file,
102 the mail message that just arrived gets distributed into the right folder
103 (and more). If no rcfile is found, or processing of the rcfile falls off
104 the end, procmail will store the mail in the default system
105 mailbox.
106 .PP
107 If no rcfiles and no
108 .B \-p
109 have been specified on the command line, procmail will, prior to reading $HOME/.procmailrc, interpret commands from
110 .B /etc/procmailrc
111 (if present).
112 Care must be taken when creating /etc/procmailrc, because, if circumstances permit, it will be executed with root privileges (contrary to the $HOME/.procmailrc file of course).
113 .PP
114 If running suid root or with root privileges, procmail will be able to
115 perform as a functionally enhanced, backwards compatible mail delivery agent.
116 .PP
117 Procmail can also be used as a general purpose mail filter, i.e., provisions
118 have been made to enable procmail to be invoked in a special sendmail rule.
119 .PP
120 The rcfile format is described in detail in the
121 .BR procmailrc (5)
122 man page.
123 .PP
124 The weighted scoring technique is described in detail in the
125 .BR procmailsc (5)
126 man page.
127 .PP
128 Examples for rcfile recipes can be looked up in the
129 .BR procmailex (5)
130 man page.
131 .SS Signals
132 .TP 1.2i
133 .B TERMINATE
134 Terminate prematurely and requeue the mail.
135 .TP
136 .B HANGUP
137 Terminate prematurely and bounce the mail.
138 .TP
139 .B INTERRUPT
140 Terminate prematurely and bounce the mail.
141 .TP
142 .B QUIT
143 Terminate prematurely and silently lose the mail.
144 .TP
145 .B ALARM
146 Force a timeout (see
147 .BR TIMEOUT).
148 .TP
149 .B USR1
150 Equivalent to a
151 .BR VERBOSE =off.
152 .TP
153 .B USR2
154 Equivalent to a
155 .BR VERBOSE =on.
156 .SH OPTIONS
157 .TP 0.5i
158 .B \-v
159 Procmail will print its version number, display its compile time
160 configuration and exit.
161 .TP
162 .B \-p
163 Preserve any old environment. Normally procmail clears the environment
164 upon startup, except for the value of TZ. However, in any case: any default values will override
165 any preexisting environment variables, i.e., procmail will not pay any attention
166 to any predefined environment variables, it will happily overwrite them
167 with its own defaults. For the list of environment variables that procmail
168 will preset see the
169 .BR procmailrc (5)
170 man page. If both \-p and \-m are specified, the
171 list of preset environment variables shrinks to just: LOGNAME, HOME, SHELL,
172 USER_SHELL, ORGMAIL and MAILDIR.
173 .TP
174 .B \-t
175 Make procmail fail softly, i.e., if procmail cannot deliver the mail to
176 any of the destinations you gave, the mail will not bounce, but will return
177 to the mailqueue. Another delivery-attempt will be made at some time in
178 the future.
179 .TP
180 .I "\fB\-f\fP fromwhom"
181 Causes procmail to regenerate the leading `From ' line with
182 .I fromwhom
183 as the sender (instead of \-f one could use the alternate and
184 obsolete \-r). If
185 .I fromwhom
186 consists merely of a single `-', then procmail will only
187 update the timestamp on the `From ' line (if present, if not, it will
188 generate a new one).
189 .TP
190 .B \-o
191 Instead of allowing anyone to generate `From ' lines, simply override
192 the fakes.
193 .TP
194 .B \-Y
195 Assume traditional Berkeley mailbox format, ignore any
196 .B Content-Length:
197 fields.
198 .TP
199 .I "\fB\-a\fP argument"
200 This will set $1 to be equal to
201 .IR argument .
202 Each succeeding
203 .I "\fB\-a\fP argument"
204 will set the next number variable ($2, $3, etc). It can be used
205 to pass meta information along to procmail. This is typically done
206 by passing along the $@x information from the sendmail mailer rule.
207 .TP
208 .I "\fB\-d\fP recipient .\|.\|."
209 This turns on explicit delivery mode, delivery will be to the local user
210 .IR recipient .
211 This, of course, only is possible if procmail has root
212 privileges (or if procmail is already running with the recipient's euid and egid).
213 Procmail will setuid to the intended recipients and delivers the mail as
214 if it were invoked by the recipient with no arguments (i.e., if no rcfile
215 is found, delivery is like ordinary mail). This option is incompatible with
216 .BR \-p .
217 .TP
218 .B \-m
219 Turns procmail into a general purpose mail filter. In this mode one rcfile
220 must be specified on the command line. After the rcfile, procmail will
221 accept an unlimited number of arguments.
222 If the rcfile is an absolute path starting with
223 .B /etc/procmailrcs/
224 without backward references (i.e. the parent directory cannot be mentioned) procmail will, only if no security violations are found, take on the identity of the owner of the rcfile (or symbolic link).
225 For some advanced usage of this option you should look in the
226 .B EXAMPLES
227 section below.
228 .TP
229 .B \-z
230 This turns on LMTP mode, wherein procmail acts as an RFC2033 LMTP server.
231 Delivery takes place in the same manner and under the same restrictions as
232 the delivery mode enabled with
233 .BR \-d .
234 This option is incompatible with
235 .B \-p
236 and
237 .BR \-f .
238
239 .SH ARGUMENTS
240 Any arguments containing an '=' are considered to be environment variable
241 assignments, they will
242 .I all
243 be evaluated after the default values have been
244 assigned and before the first rcfile is opened.
245 .PP
246 Any other arguments are presumed to be rcfile paths (either absolute,
247 or if they start with `./' relative to the current
248 directory;
249 .B any other relative
250 path is relative to $HOME, unless the
251 .B \-m
252 option has been given, in which case all relative paths are relative to the
253 current directory); procmail will start with the first one it finds on the
254 command line. The following ones will only be parsed if the preceding ones
255 have a not matching HOST-directive entry, or in case they should not exist.
256 .PP
257 If no rcfiles are specified, it looks for
258 .BR $HOME/.procmailrc .
259 If not even that can be found, processing will continue according to
260 the default settings of the environment variables and the ones specified
261 on the command line.
262 .SH EXAMPLES
263 Examples for rcfile recipes can be looked up in the
264 .BR procmailex (5)
265 man page.
266 A small sample rcfile can be found in the
267 .B NOTES
268 section below.
269 .PP
270 Skip the rest of this EXAMPLES section unless you are a system administrator
271 who is vaguely familiar with sendmail.cf syntax.
272 .PP
273 The
274 .B \-m
275 option is typically used when procmail is called from within a rule in the
276 sendmail.cf file. In order to be able to do this it is convenient to create
277 an extra `procmail' mailer in your sendmail.cf file (in addition to the perhaps
278 already present `local' mailer that starts up procmail). To create such a
279 `procmail' mailer I'd suggest something like:
280 .Sx 2
281 Mprocmail, P=/usr/bin/procmail, F=mSDFMhun, S=11, R=21,
282 A=procmail \-m $h $g $u
283 .Ex
284 This enables you to use rules like the following (most likely in ruleset 0)
285 to filter mail through the procmail mailer (please note the leading tab
286 to continue the rule, and the tab to separate the comments):
287 .Sx 4
288 R$*<@some.where>$*
289 $#procmail $@/etc/procmailrcs/some.rc $:[email protected]$2
290 R$*<@$*.procmail>$*
291 $1<@$2>$3 Already filtered, map back
292 .Ex
293 And /etc/procmailrcs/some.rc could be as simple as:
294 .Sx 9
295 SENDER = "<$1>" # fix for empty sender addresses
296 SHIFT = 1 # remove it from $@
297
298 :0 # sink all junk mail
299 * ^Subject:.*junk
300 /dev/null
301
302 :0 w # pass along all other mail
303 ! \-oi \-f "$SENDER" "$@"
304 .Ex
305 Do watch out when sending mail from within the /etc/procmailrcs/some.rc file,
306 if you send mail to addresses which match the first rule again, you could
307 be creating an endless mail loop.
308 .SH FILES
309 .TP 2.3i
310 .B /etc/passwd
311 to set the recipient's LOGNAME, HOME and USER_SHELL variable defaults
312 .TP
313 .B /var/spool/mail/$LOGNAME
314 system mailbox; both the system mailbox and the immediate directory
315 it is in will be created every time procmail starts and either one is
316 not present
317 .TP
318 .B /etc/procmailrc
319 initial global rcfile
320 .TP
321 .B /etc/procmailrcs/
322 special privileges path for rcfiles
323 .TP
324 .B $HOME/.procmailrc
325 default rcfile
326 .TP
327 .B /var/spool/mail/$LOGNAME.lock
328 lockfile for the system mailbox (not automatically used by procmail, unless
329 $DEFAULT equals /var/spool/mail/$LOGNAME and procmail is delivering to $DEFAULT)
330 .TP
331 .B /usr/sbin/sendmail
332 default mail forwarder
333 .TP
334 .B _????`hostname`
335 temporary `unique' zero-length files created by procmail
336 .SH "SEE ALSO"
337 .na
338 .nh
339 .BR procmailrc (5),
340 .BR procmailsc (5),
341 .BR procmailex (5),
342 .BR sh (1),
343 .BR csh (1),
344 .BR mail (1),
345 .BR mailx (1),
346 .BR uucp (1),
347 .BR aliases (5),
348 .BR sendmail (8),
349 .BR egrep (1),
350 .BR grep (1),
351 .BR biff (1),
352 .BR comsat (8),
353 .BR lockfile (1),
354 .BR formail (1),
355 .BR cron (1)
356 .hy
357 .ad
358 .SH DIAGNOSTICS
359 .TP 2.3i
360 Autoforwarding mailbox found
361 The system mailbox had its suid or sgid bit set, procmail terminates with
362 EX_NOUSER assuming that this mailbox must not be delivered to.
363 .TP
364 Bad substitution of "x"
365 Not a valid environment variable name specified.
366 .TP
367 Closing brace unexpected
368 There was no corresponding opening brace (nesting block).
369 .TP
370 Conflicting options
371 Not all option combinations are useful
372 .TP
373 Conflicting x suppressed
374 Flag x is not compatible with some other flag on this recipe.
375 .TP
376 Couldn't create "x"
377 The system mailbox was missing and could not/will not be created.
378 .TP
379 Couldn't create maildir part "x"
380 The maildir folder "x" is missing one or more required subdirectories and
381 procmail could not create them.
382 .TP
383 Couldn't create or rename temp file "x"
384 An error occurred in the mechanics of delivering to the directory folder "x".
385 .TP
386 Couldn't determine implicit lockfile from "x"
387 There were no `>>' redirectors to be found, using simply `$LOCKEXT' as
388 locallockfile.
389 .TP
390 Couldn't read "x"
391 Procmail was unable to open an rcfile or it was not a regular file, or
392 procmail couldn't open an MH directory to find the highest numbered file.
393 .TP
394 Couldn't unlock "x"
395 Lockfile was already gone, or write permission to the directory where the
396 lockfile is has been denied.
397 .TP
398 Deadlock attempted on "x"
399 The locallockfile specified on this recipe is equal to a still active
400 $LOCKFILE.
401 .TP
402 Denying special privileges for "x"
403 Procmail will not take on the identity that comes with the rcfile because
404 a security violation was found (e.g.
405 .B \-p
406 or variable assignments on the command line) or procmail had insufficient privileges to do so.
407 .TP
408 Descriptor "x" was not open
409 As procmail was started, stdin, stdout or stderr was not connected (possibly
410 an attempt to subvert security)
411 .TP
412 Enforcing stricter permissions on "x"
413 The system mailbox of the recipient was found to be unsecured, procmail
414 secured it.
415 .TP
416 Error while writing to "x"
417 Nonexistent subdirectory, no write permission, pipe died or disk full.
418 .TP
419 Exceeded LINEBUF
420 Buffer overflow detected, LINEBUF was too small, PROCMAIL_OVERFLOW has
421 been set.
422 .TP
423 MAILDIR is not an absolute path
424 .TP
425 MAILDIR path too long
426 .TP
427 ORGMAIL is not an absolute path
428 .TP
429 ORGMAIL path too long
430 .TP
431 default rcfile is not an absolute path
432 .TP
433 default rcfile path too long
434 The specified item's full path, when expanded, was longer than LINEBUF
435 or didn't start with a file separator.
436 .TP
437 Excessive output quenched from "x"
438 The backquoted expression "x" tried to produce too much output for
439 the current LINEBUF; the rest was discarded and PROCMAIL_OVERFLOW
440 has been set.
441 .TP
442 Extraneous x ignored
443 The action line or other flags on this recipe make x meaningless.
444 .TP
445 Failed forking "x"
446 Process table is full (and NORESRETRY has been exhausted).
447 .TP
448 Failed to execute "x"
449 Program not in path, or not executable.
450 .TP
451 Forced unlock denied on "x"
452 No write permission in the directory where
453 .B lockfile
454 "x" resides, or more than one procmail trying to force a lock at exactly the
455 same time.
456 .TP
457 Forcing lock on "x"
458 .B Lockfile
459 "x" is going to be removed by force because of a timeout (see also:
460 .BR LOCKTIMEOUT ).
461 .TP
462 Incomplete recipe
463 The start of a recipe was found, but it stranded in an EOF.
464 .TP
465 Insufficient privileges
466 Procmail either needs root privileges, or must have the
467 right (e)uid
468 .B and
469 (e)gid to run in delivery mode. The mail will bounce.
470 .TP
471 Invalid regexp "x"
472 The regular expression "x" contains errors (most likely some missing or
473 extraneous parens).
474 .TP
475 Kernel-lock failed
476 While trying to use the kernel-supported locking calls, one of them failed
477 (usually indicates an OS error), procmail ignores this error and proceeds.
478 .TP
479 Kernel-unlock failed
480 See above.
481 .TP
482 Lock failure on "x"
483 Can only occur if you specify some real weird (and illegal) lockfilenames
484 or if the
485 .B lockfile
486 could not be created because of insufficient permissions or nonexistent
487 subdirectories.
488 .TP
489 Lost "x"
490 Procmail tried to clone itself but could not find back rcfile "x" (it either
491 got removed or it was a relative path and you changed directory since
492 procmail opened it last time).
493 .TP
494 Missing action
495 The current recipe was found to be incomplete.
496 .TP
497 Missing closing brace
498 A nesting block was started, but never finished.
499 .TP
500 Missing name
501 The \-f option needs an extra argument.
502 .TP
503 Missing argument
504 You specified the \-a option but forgot the argument.
505 .TP
506 Missing rcfile
507 You specified the \-m option, procmail expects the name of an
508 rcfile as argument.
509 .TP
510 Missing recipient
511 You specified the \-d option or called procmail under a different
512 name, it expects one or more recipients as arguments.
513 .TP
514 No space left to finish writing "x"
515 The filesystem containing "x" does not have enough free space to permit
516 delivery of the message to the file.
517 .TP
518 Out of memory
519 The system is out of swap space (and NORESRETRY has been exhausted).
520 .TP
521 Processing continued
522 The unrecognised options on the command line are ignored, proceeding as
523 usual.
524 .TP
525 Program failure (nnn) of "x"
526 Program that was started by procmail returned nnn instead of
527 EXIT_SUCCESS (=0);
528 if nnn is negative, then this is the signal the program died on.
529 .TP
530 Quota exceeded while writing "x"
531 The filesize quota for the recipient on the filesystem containing "x"
532 does not permit delivering the message to the file.
533 .TP
534 Renaming bogus "x" into "x"
535 The system mailbox of the recipient was found to be bogus, procmail performed
536 evasive actions.
537 .TP
538 Rescue of unfiltered data succeeded/failed
539 A filter returned unsuccessfully, procmail tried to get back the original text.
540 .TP
541 Skipped: "x"
542 Couldn't do anything with "x" in the rcfile (syntax error), ignoring it.
543 .TP
544 Suspicious rcfile "x"
545 The owner of the rcfile was not the recipient or root, the file was
546 world writable, or the directory that contained it was world writable,
547 or this was the default rcfile ($HOME/.procmailrc) and either it was group
548 writable or the directory that contained it was group writable (the
549 rcfile was not used).
550 .TP
551 Terminating prematurely whilst waiting for .\|.\|.
552 Procmail received a signal while it was waiting for .\|.\|.
553 .TP
554 Timeout, terminating "x"
555 Timeout has occurred on program or filter "x".
556 .TP
557 Timeout, was waiting for "x"
558 Timeout has occurred on program, filter or file "x". If it was a program or
559 filter, then it didn't seem to be running anymore.
560 .TP
561 Truncated file to former size
562 The file could not be delivered to successfully, so the file was truncated
563 to its former size.
564 .TP
565 Truncating "x" and retrying lock
566 "x" does not seem to be a valid filename or the file is not empty.
567 .TP
568 Unable to treat as directory "x"
569 Either the suffix on "x" would indicate that it should be an MH or
570 maildir folder, or it was listed as an second folder into which to link,
571 but it already exists and is not a directory.
572 .TP
573 Unexpected EOL
574 Missing closing quote, or trying to escape EOF.
575 .TP
576 Unknown user "x"
577 The specified recipient does not have a corresponding uid.
578 .SH "EXTENDED DIAGNOSTICS"
579 Extended diagnostics can be turned on and off through setting the
580 VERBOSE variable.
581 .TP 2.3i
582 [pid] time & date
583 Procmail's pid and a timestamp. Generated whenever procmail logs a
584 diagnostic and at least a second has elapsed since the last timestamp.
585 .TP
586 Acquiring kernel-lock
587 Procmail now tries to kernel-lock the most recently opened file (descriptor).
588 .TP
589 Assigning "x"
590 Environment variable assignment.
591 .TP
592 Assuming identity of the recipient, VERBOSE=off
593 Dropping all privileges (if any), implicitly turns off extended diagnostics.
594 .TP
595 Bypassed locking "x"
596 The mail spool directory was not accessible to procmail, it relied solely
597 on kernel locks.
598 .TP
599 Executing "x"
600 Starting program "x". If it is started by procmail directly (without an
601 intermediate shell), procmail will show where it separated the arguments
602 by inserting commas.
603 .TP
604 HOST mismatched "x"
605 This host was called "x", HOST contained something else.
606 .TP
607 Locking "x"
608 Creating lockfile "x".
609 .TP
610 Linking to "x"
611 Creating a hardlink between directory folders.
612 .TP
613 Match on "x"
614 Condition matched.
615 .TP
616 Matched "x"
617 Assigned "x" to
618 .BR MATCH .
619 .TP
620 No match on "x"
621 Condition didn't match, recipe skipped.
622 .TP
623 Non-zero exitcode (nnn) by "x"
624 Program that was started by procmail as a condition or as the action of
625 a recipe with the `W' flag returned nnn instead of
626 EXIT_SUCCESS (=0); the usage indicates that this is not an
627 entirely unexpected condition.
628 .TP
629 Notified comsat: "$LOGNAME@offset:file"
630 Sent comsat/biff a notice that mail arrived for user $LOGNAME at `offset'
631 in `file'.
632 .TP
633 Opening "x"
634 Opening file "x" for appending.
635 .TP
636 Rcfile: "x"
637 Rcfile changed to "x".
638 .TP
639 Reiterating kernel-lock
640 While attempting several locking methods, one of these failed. Procmail will
641 reiterate until they all succeed in rapid succession.
642 .TP
643 Score: added newtotal "x"
644 This condition scored `added' points, which resulted in a `newtotal' score.
645 .TP
646 Unlocking "x"
647 Removing lockfile "x" again.
648 .SH WARNINGS
649 You should create a shell script that uses
650 .BR lockfile (1)
651 before invoking your mail shell on any mailbox file other than the system
652 mailbox (unless of course, your mail shell uses the same lockfiles (local
653 or global) you specified in your rcfile).
654 .PP
655 In the unlikely event that you absolutely need to kill procmail before it has
656 finished, first try and use the regular kill command (i.e.,
657 .I not
658 kill \-9, see the subsection
659 .I Signals
660 for suggestions), otherwise some
661 .I lockfiles
662 might not get removed.
663 .PP
664 Beware when using the
665 .B \-t
666 option, if procmail repeatedly is unable to deliver the mail (e.g., due to
667 an incorrect rcfile), the system mailqueue could fill up. This could
668 aggravate both the local postmaster and other users.
669 .PP
670 The
671 .B /etc/procmailrc
672 file might be executed with root privileges, so be very careful of what you put in it.
673 .B SHELL
674 will be equal to that of the current recipient, so if procmail has to invoke the shell, you'd better set it to some safe value first.
675 See also\h'-\w' 'u' :
676 .BR DROPPRIVS .
677 .PP
678 Keep in mind that if
679 .BR chown (1)
680 is permitted on files in
681 .BR /etc/procmailrcs/ ,
682 that they can be chowned to root (or anyone else) by their current owners.
683 For maximum security, make sure this directory is
684 .I executable
685 to root only.
686 .PP
687 Procmail is not the proper tool for sharing one mailbox among many
688 users, such as when you have one POP account for all mail to your
689 domain. It can be done if you manage to configure your MTA to add some
690 headers with the envelope recipient data in order to tell Procmail who
691 a message is for, but this is usually not the right thing to do.
692 Perhaps you want to investigate if your MTA offers `virtual user
693 tables', or check out the `multidrop' facility of Fetchmail.
694 .SH BUGS
695 After removing a lockfile by force, procmail waits $SUSPEND seconds before
696 creating a new lockfile so that another process that decides to remove the
697 stale lockfile will not remove the newly created lock by mistake.
698 .PP
699 Procmail uses the regular TERMINATE signal to terminate any runaway filter,
700 but it does not check if the filter responds to that signal and it only sends
701 it to the filter itself, not to any of the filter's children.
702 .PP
703 A continued
704 .B Content-Length:
705 field is not handled correctly.
706 .SH MISCELLANEOUS
707 If there is an existing
708 .B Content-Length:
709 field in the header of the mail and the
710 .B \-Y
711 option is not specified, procmail will trim the field to report the correct
712 size. Procmail does not change the fieldwidth.
713 .PP
714 If there is no
715 .B Content-Length:
716 field or the
717 .B \-Y
718 option has been specified and procmail appends to regular mailfolders, any
719 lines in the body of the message that look like postmarks are prepended with
720 `>' (disarms bogus mailheaders). The regular expression that is used
721 to search for these postmarks is:
722 .RS
723 `\\nFrom '
724 .RE
725 .PP
726 If the destination name used in explicit delivery mode is not in /etc/passwd,
727 procmail will proceed as if explicit delivery mode was not in effect.
728 If not in explicit delivery mode and
729 should the uid procmail is running under, have no corresponding /etc/passwd
730 entry, then HOME will default to /, LOGNAME will default to #uid,
731 USER_SHELL will default to /bin/sh, and ORGMAIL will default to
732 /tmp/dead.letter.
733 .PP
734 When in explicit delivery mode, procmail will generate a leading `From '
735 line if none is present. If one is already present procmail will leave it
736 intact. If procmail is not invoked with one of the following user or group ids\h'-\w' 'u' : root, daemon, uucp, mail, x400, network, list, slist, lists or news, but still has to generate or accept a new `From ' line,
737 it will generate an additional `>From ' line to help distinguish
738 fake mails.
739 .PP
740 For security reasons procmail will only use an absolute or
741 $HOME-relative rcfile if it is owned by the recipient or root, not
742 world writable, and the directory it is contained in is not world
743 writable. The $HOME/.procmailrc file has the additional constraint of not
744 being group-writable or in a group-writable directory.
745 .PP
746 If /var/spool/mail/$LOGNAME is a bogus mailbox (i.e., does not belong to the
747 recipient, is unwritable, is a symbolic link or is a hard link), procmail will
748 upon startup try to rename it into a file starting
749 with `BOGUS.$LOGNAME.' and
750 ending in an inode-sequence-code. If this turns out to be impossible,
751 .B ORGMAIL
752 will have
753 .I no
754 initial value, and hence will inhibit delivery without a proper rcfile.
755 .PP
756 If /var/spool/mail/$LOGNAME already is a valid mailbox, but has got too loose
757 permissions on it, procmail will correct this. To prevent procmail from doing
758 this make sure the u+x bit is set.
759 .PP
760 When delivering to directories, MH folders, or maildir folders, you
761 .B don't
762 need to use lockfiles to prevent several concurrently running procmail
763 programs from messing up.
764 .PP
765 Delivering to MH folders is slightly more time consuming than delivering
766 to normal directories or mailboxes, because procmail has to search for
767 the next available number (instead of having the filename immediately
768 available).
769 .PP
770 On general failure procmail will return EX_CANTCREAT, unless option
771 .B \-t
772 is specified, in which case it will return EX_TEMPFAIL.
773 .PP
774 To make `egrepping' of headers more consistent, procmail concatenates all
775 continued header fields; but only internally. When delivering the mail, line
776 breaks will appear as before.
777 .PP
778 If procmail is called under a name not starting with `procmail' (e.g., if it
779 is linked to another name and invoked as such), it comes up in explicit
780 delivery mode, and expects the recipients' names as command line arguments
781 (as if \-d had been specified).
782 .PP
783 Comsat/biff notifications are done using udp. They are sent off
784 once when procmail generates the regular logfile entry. The notification
785 messages have the following extended format (or as close as you can get when
786 final delivery was not to a file):
787 .RS
788 $LOGNAME@offset_of_message_in_mailbox\h'-\w' 'u' :absolute_path_to_mailbox
789 .RE
790 .PP
791 Whenever procmail itself opens a file to deliver to, it
792 consistently uses the following kernel locking strategies\h'-\w' 'u' :
793 .BR fcntl (2).
794 .PP
795 Procmail is NFS-resistant and eight-bit clean.
796 .br
797 .ne 11
798 .SH NOTES
799 Calling up procmail with the \-h or \-? options will cause
800 it to display a command-line help and recipe flag quick-reference page.
801 .PP
802 There exists an excellent newbie FAQ about mailfilters (and procmail
803 in particular); it is maintained by Nancy McGough <[email protected]>
804 and can be obtained by sending a mail to [email protected] with
805 the following in the body:
806 .RS
807 send usenet/news.answers/mail/filtering-faq
808 .RE
809 .PP
810 If procmail is
811 .I not
812 installed globally as the default mail delivery agent (ask your system administrator), you have to make sure it is invoked when your mail arrives.
813 In this case your $HOME/.forward (beware, it
814 .B has
815 to be world readable) file should contain the line below. Be sure to include
816 the single and double quotes, and unless you know your site to be running
817 smrsh (the SendMail Restricted SHell), it must be an
818 .I absolute
819 path.
820 .PP
821 .na
822 .nf
823 "\h'-\w' 'u' |exec /usr/bin/procmail"
824 .fi
825 .ad
826 .PP
827 Some mailers (notably exim) do not currently accept the above syntax.
828 In such case use this instead:
829 .PP
830 .na
831 .nf
832 |/usr/bin/procmail
833 .fi
834 .ad
835 .PP
836 Procmail can also be invoked to postprocess an already filled system
837 mailbox. This can be useful if you don't want to or can't use a
838 $HOME/.forward file (in which case the following script could
839 periodically be called from within
840 .BR cron (1),
841 or whenever you start reading mail):
842 .Sx 17
843 #!/bin/sh
844
845 ORGMAIL=/var/spool/mail/$LOGNAME
846
847 if cd $HOME &&
848 test \-s $ORGMAIL &&
849 lockfile \-r0 \-l1024 .newmail.lock 2>/dev/null
850 then
851 trap "rm \-f .newmail.lock" 1 2 3 13 15
852 umask 077
853 lockfile \-l1024 \-ml
854 cat $ORGMAIL >>.newmail &&
855 cat /dev/null >$ORGMAIL
856 lockfile \-mu
857 formail \-s procmail <.newmail &&
858 rm \-f .newmail
859 rm \-f .newmail.lock
860 fi
861 exit 0
862 .Ex
863 .ne 14
864 .SS "A sample small $HOME/.procmailrc:"
865 .na
866 .nf
867 PATH=/usr/local/bin:/bin:/usr/bin
868 MAILDIR=$HOME/Mail #you'd better make sure it exists
869 DEFAULT=$MAILDIR/mbox #completely optional
870 LOGFILE=$MAILDIR/from #recommended
871
872 :0:
873 * ^From.*berg
874 from_me
875
876 :0
877 * ^Subject:.*Flame
878 /dev/null
879 .fi
880 .ad
881 .PP
882 Other examples for rcfile recipes can be looked up in the
883 .BR procmailex (5)
884 man page.
885 .Sh SOURCE
886 This program is part of the
887 .I procmail mail-processing-package
888 (v3.24) available at http://www.procmail.org/ or
889 ftp.procmail.org in
890 .BR pub/procmail/ .
891 .Sh MAILINGLIST
892 There exists a mailinglist for questions relating to any program in the
893 procmail package:
894 .RS
895 <[email protected]>
896 .RS
897 for submitting questions/answers.
898 .RE
899 <[email protected]>
900 .RS
901 for subscription requests.
902 .RE
903 .PP
904 .RE
905 If you would like to stay informed about new versions and official patches send
906 a subscription request to
907 .RS
908 [email protected]
909 .RE
910 (this is a readonly list).
911 .SH AUTHORS
912 Stephen R. van den Berg
913 .RS
914 <[email protected]>
915 .RE
916 .\".if n .pl -(\n(.tu-1i)
917 .rm SH
918 .rn Sh SH
919 .rm SS
920 .rn Ss SS
921 .rm TP
922 .rn Tp TP
923 .rm RS
924 .rn Rs RS
925 .rm RE
926 .rn Re RE