Debian Codegraph @

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