Debian Codegraph @

upstream/mageia-cauldron/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 .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 USER_SHELL, 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 USER_SHELL variable defaults
296 .TP
297 .B /var/spool/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/spool/mail/$LOGNAME.lock
312 lockfile for the system mailbox (not automatically used by procmail, unless
313 $DEFAULT equals /var/spool/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 backquoted expression "x" tried to produce too much output for
423 the current LINEBUF; the rest was discarded and PROCMAIL_OVERFLOW
424 has been set.
425 .TP
426 Extraneous x ignored
427 The action line or other flags on this recipe make x meaningless.
428 .TP
429 Failed forking "x"
430 Process table is full (and NORESRETRY has been exhausted).
431 .TP
432 Failed to execute "x"
433 Program not in path, or not executable.
434 .TP
435 Forced unlock denied on "x"
436 No write permission in the directory where
437 .B lockfile
438 "x" resides, or more than one procmail trying to force a lock at exactly the
439 same time.
440 .TP
441 Forcing lock on "x"
442 .B Lockfile
443 "x" is going to be removed by force because of a timeout (see also:
444 .BR LOCKTIMEOUT ).
445 .TP
446 Incomplete recipe
447 The start of a recipe was found, but it stranded in an EOF.
448 .TP
449 Insufficient privileges
450 Procmail either needs root privileges, or must have the
451 right (e)uid
452 .B and
453 (e)gid to run in delivery mode. The mail will bounce.
454 .TP
455 Invalid regexp "x"
456 The regular expression "x" contains errors (most likely some missing or
457 extraneous parens).
458 .TP
459 Kernel-lock failed
460 While trying to use the kernel-supported locking calls, one of them failed
461 (usually indicates an OS error), procmail ignores this error and proceeds.
462 .TP
463 Kernel-unlock failed
464 See above.
465 .TP
466 Lock failure on "x"
467 Can only occur if you specify some real weird (and illegal) lockfilenames
468 or if the
469 .B lockfile
470 could not be created because of insufficient permissions or nonexistent
471 subdirectories.
472 .TP
473 Lost "x"
474 Procmail tried to clone itself but could not find back rcfile "x" (it either
475 got removed or it was a relative path and you changed directory since
476 procmail opened it last time).
477 .TP
478 Missing action
479 The current recipe was found to be incomplete.
480 .TP
481 Missing closing brace
482 A nesting block was started, but never finished.
483 .TP
484 Missing name
485 The \-f option needs an extra argument.
486 .TP
487 Missing argument
488 You specified the \-a option but forgot the argument.
489 .TP
490 Missing rcfile
491 You specified the \-m option, procmail expects the name of an
492 rcfile as argument.
493 .TP
494 Missing recipient
495 You specified the \-d option or called procmail under a different
496 name, it expects one or more recipients as arguments.
497 .TP
498 No space left to finish writing "x"
499 The filesystem containing "x" does not have enough free space to permit
500 delivery of the message to the file.
501 .TP
502 Out of memory
503 The system is out of swap space (and NORESRETRY has been exhausted).
504 .TP
505 Processing continued
506 The unrecognised options on the command line are ignored, proceeding as
507 usual.
508 .TP
509 Program failure (nnn) of "x"
510 Program that was started by procmail returned nnn instead of
511 EXIT_SUCCESS (=0);
512 if nnn is negative, then this is the signal the program died on.
513 .TP
514 Quota exceeded while writing "x"
515 The filesize quota for the recipient on the filesystem containing "x"
516 does not permit delivering the message to the file.
517 .TP
518 Renaming bogus "x" into "x"
519 The system mailbox of the recipient was found to be bogus, procmail performed
520 evasive actions.
521 .TP
522 Rescue of unfiltered data succeeded/failed
523 A filter returned unsuccessfully, procmail tried to get back the original text.
524 .TP
525 Skipped: "x"
526 Couldn't do anything with "x" in the rcfile (syntax error), ignoring it.
527 .TP
528 Suspicious rcfile "x"
529 The owner of the rcfile was not the recipient or root, the file was
530 world writable, or the directory that contained it was world writable,
531 or this was the default rcfile ($HOME/.procmailrc) and either it was group
532 writable or the directory that contained it was group writable (the
533 rcfile was not used).
534 .TP
535 Terminating prematurely whilst waiting for .\|.\|.
536 Procmail received a signal while it was waiting for .\|.\|.
537 .TP
538 Timeout, terminating "x"
539 Timeout has occurred on program or filter "x".
540 .TP
541 Timeout, was waiting for "x"
542 Timeout has occurred on program, filter or file "x". If it was a program or
543 filter, then it didn't seem to be running anymore.
544 .TP
545 Truncated file to former size
546 The file could not be delivered to successfully, so the file was truncated
547 to its former size.
548 .TP
549 Truncating "x" and retrying lock
550 "x" does not seem to be a valid filename or the file is not empty.
551 .TP
552 Unable to treat as directory "x"
553 Either the suffix on "x" would indicate that it should be an MH or
554 maildir folder, or it was listed as an second folder into which to link,
555 but it already exists and is not a directory.
556 .TP
557 Unexpected EOL
558 Missing closing quote, or trying to escape EOF.
559 .TP
560 Unknown user "x"
561 The specified recipient does not have a corresponding uid.
562 .SH "EXTENDED DIAGNOSTICS"
563 Extended diagnostics can be turned on and off through setting the
564 VERBOSE variable.
565 .TP 2.3i
566 [pid] time & date
567 Procmail's pid and a timestamp. Generated whenever procmail logs a
568 diagnostic and at least a second has elapsed since the last timestamp.
569 .TP
570 Acquiring kernel-lock
571 Procmail now tries to kernel-lock the most recently opened file (descriptor).
572 .TP
573 Assigning "x"
574 Environment variable assignment.
575 .TP
576 Assuming identity of the recipient, VERBOSE=off
577 Dropping all privileges (if any), implicitly turns off extended diagnostics.
578 .TP
579 Bypassed locking "x"
580 The mail spool directory was not accessible to procmail, it relied solely
581 on kernel locks.
582 .TP
583 Executing "x"
584 Starting program "x". If it is started by procmail directly (without an
585 intermediate shell), procmail will show where it separated the arguments
586 by inserting commas.
587 .TP
588 HOST mismatched "x"
589 This host was called "x", HOST contained something else.
590 .TP
591 Locking "x"
592 Creating lockfile "x".
593 .TP
594 Linking to "x"
595 Creating a hardlink between directory folders.
596 .TP
597 Match on "x"
598 Condition matched.
599 .TP
600 Matched "x"
601 Assigned "x" to
602 .BR MATCH .
603 .TP
604 No match on "x"
605 Condition didn't match, recipe skipped.
606 .TP
607 Non-zero exitcode (nnn) by "x"
608 Program that was started by procmail as a condition or as the action of
609 a recipe with the `W' flag returned nnn instead of
610 EXIT_SUCCESS (=0); the usage indicates that this is not an
611 entirely unexpected condition.
612 .TP
613 Notified comsat: "$LOGNAME@offset:file"
614 Sent comsat/biff a notice that mail arrived for user $LOGNAME at `offset'
615 in `file'.
616 .TP
617 Opening "x"
618 Opening file "x" for appending.
619 .TP
620 Rcfile: "x"
621 Rcfile changed to "x".
622 .TP
623 Reiterating kernel-lock
624 While attempting several locking methods, one of these failed. Procmail will
625 reiterate until they all succeed in rapid succession.
626 .TP
627 Score: added newtotal "x"
628 This condition scored `added' points, which resulted in a `newtotal' score.
629 .TP
630 Unlocking "x"
631 Removing lockfile "x" again.
632 .SH WARNINGS
633 You should create a shell script that uses
634 .BR lockfile (1)
635 before invoking your mail shell on any mailbox file other than the system
636 mailbox (unless of course, your mail shell uses the same lockfiles (local
637 or global) you specified in your rcfile).
638 .PP
639 In the unlikely event that you absolutely need to kill procmail before it has
640 finished, first try and use the regular kill command (i.e.,
641 .I not
642 kill \-9, see the subsection
643 .I Signals
644 for suggestions), otherwise some
645 .I lockfiles
646 might not get removed.
647 .PP
648 Beware when using the
649 .B \-t
650 option, if procmail repeatedly is unable to deliver the mail (e.g., due to
651 an incorrect rcfile), the system mailqueue could fill up. This could
652 aggravate both the local postmaster and other users.
653 .PP
654 The
655 .B /etc/procmailrc
656 file might be executed with root privileges, so be very careful of what you put in it.
657 .B SHELL
658 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.
659 See also\h'-\w' 'u' :
660 .BR DROPPRIVS .
661 .PP
662 Keep in mind that if
663 .BR chown (1)
664 is permitted on files in
665 .BR /etc/procmailrcs/ ,
666 that they can be chowned to root (or anyone else) by their current owners.
667 For maximum security, make sure this directory is
668 .I executable
669 to root only.
670 .PP
671 Procmail is not the proper tool for sharing one mailbox among many
672 users, such as when you have one POP account for all mail to your
673 domain. It can be done if you manage to configure your MTA to add some
674 headers with the envelope recipient data in order to tell Procmail who
675 a message is for, but this is usually not the right thing to do.
676 Perhaps you want to investigate if your MTA offers `virtual user
677 tables', or check out the `multidrop' facility of Fetchmail.
678 .SH BUGS
679 After removing a lockfile by force, procmail waits $SUSPEND seconds before
680 creating a new lockfile so that another process that decides to remove the
681 stale lockfile will not remove the newly created lock by mistake.
682 .PP
683 Procmail uses the regular TERMINATE signal to terminate any runaway filter,
684 but it does not check if the filter responds to that signal and it only sends
685 it to the filter itself, not to any of the filter's children.
686 .PP
687 A continued
688 .B Content-Length:
689 field is not handled correctly.
690 .PP
691 The embedded newlines in a continued header should be skipped when
692 matching instead of being treated as a single space as they are now.
693 .SH MISCELLANEOUS
694 If there is an existing
695 .B Content-Length:
696 field in the header of the mail and the
697 .B \-Y
698 option is not specified, procmail will trim the field to report the correct
699 size. Procmail does not change the fieldwidth.
700 .PP
701 If there is no
702 .B Content-Length:
703 field or the
704 .B \-Y
705 option has been specified and procmail appends to regular mailfolders, any
706 lines in the body of the message that look like postmarks are prepended with
707 `>' (disarms bogus mailheaders). The regular expression that is used
708 to search for these postmarks is:
709 .RS
710 `\\nFrom '
711 .RE
712 .PP
713 If the destination name used in explicit delivery mode is not in /etc/passwd,
714 procmail will proceed as if explicit delivery mode was not in effect.
715 If not in explicit delivery mode and
716 should the uid procmail is running under, have no corresponding /etc/passwd
717 entry, then HOME will default to /, LOGNAME will default to #uid,
718 USER_SHELL will default to /bin/sh, and ORGMAIL will default to
719 /tmp/dead.letter.
720 .PP
721 When in explicit delivery mode, procmail will generate a leading `From '
722 line if none is present. If one is already present procmail will leave it
723 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,
724 it will generate an additional `>From ' line to help distinguish
725 fake mails.
726 .PP
727 For security reasons procmail will only use an absolute or
728 $HOME-relative rcfile if it is owned by the recipient or root, not
729 world writable, and the directory it is contained in is not world
730 writable. The $HOME/.procmailrc file has the additional constraint of not
731 being group-writable or in a group-writable directory.
732 .PP
733 If /var/spool/mail/$LOGNAME is a bogus mailbox (i.e., does not belong to the
734 recipient, is unwritable, is a symbolic link or is a hard link), procmail will
735 upon startup try to rename it into a file starting
736 with `BOGUS.$LOGNAME.' and
737 ending in an inode-sequence-code. If this turns out to be impossible,
738 .B ORGMAIL
739 will have
740 .I no
741 initial value, and hence will inhibit delivery without a proper rcfile.
742 .PP
743 If /var/spool/mail/$LOGNAME already is a valid mailbox, but has got too loose
744 permissions on it, procmail will correct this. To prevent procmail from doing
745 this make sure the u+x bit is set.
746 .PP
747 When delivering to directories, MH folders, or maildir folders, you
748 .B don't
749 need to use lockfiles to prevent several concurrently running procmail
750 programs from messing up.
751 .PP
752 Delivering to MH folders is slightly more time consuming than delivering
753 to normal directories or mailboxes, because procmail has to search for
754 the next available number (instead of having the filename immediately
755 available).
756 .PP
757 On general failure procmail will return EX_CANTCREAT, unless option
758 .B \-t
759 is specified, in which case it will return EX_TEMPFAIL.
760 .PP
761 To make `egrepping' of headers more consistent, procmail concatenates all
762 continued header fields; but only internally. When delivering the mail, line
763 breaks will appear as before.
764 .PP
765 If procmail is called under a name not starting with `procmail' (e.g., if it
766 is linked to another name and invoked as such), it comes up in explicit
767 delivery mode, and expects the recipients' names as command line arguments
768 (as if \-d had been specified).
769 .PP
770 Comsat/biff notifications are done using udp. They are sent off
771 once when procmail generates the regular logfile entry. The notification
772 messages have the following extended format (or as close as you can get when
773 final delivery was not to a file):
774 .RS
775 $LOGNAME@offset_of_message_in_mailbox\h'-\w' 'u' :absolute_path_to_mailbox
776 .RE
777 .PP
778 Whenever procmail itself opens a file to deliver to, it
779 consistently uses the following kernel locking strategies\h'-\w' 'u' :
780 .BR fcntl (2).
781 .PP
782 Procmail is NFS-resistant and eight-bit clean.
783 .br
784 .ne 11
785 .SH NOTES
786 Calling up procmail with the \-h or \-? options will cause
787 it to display a command-line help and recipe flag quick-reference page.
788 .PP
789 There exists an excellent newbie FAQ about mailfilters (and procmail
790 in particular); it is maintained by Nancy McGough <[email protected]>
791 and can be obtained by sending a mail to [email protected] with
792 the following in the body:
793 .RS
794 send usenet/news.answers/mail/filtering-faq
795 .RE
796 .PP
797 If procmail is
798 .I not
799 installed globally as the default mail delivery agent (ask your system administrator), you have to make sure it is invoked when your mail arrives.
800 In this case your $HOME/.forward (beware, it
801 .B has
802 to be world readable) file should contain the line below. Be sure to include
803 the single and double quotes, and unless you know your site to be running
804 smrsh (the SendMail Restricted SHell), it must be an
805 .I absolute
806 path.The \efB#\efP\efIYOUR_USERNAME\efP is not actually a
807 parameter that is required by procmail, in fact, it will be discarded by
808 sh before procmail ever sees it; it is however a necessary kludge against
809 overoptimising sendmail programs\h'-\w' 'u' :
810
811 .PP
812 .na
813 .nf
814 "\h'-\w' 'u' |IFS=' '&&p=/usr/bin/procmail&&test -f $p&&exec $p -Yf-\h'-\w' 'u' |\h'-\w' 'u' |exit 75 \fB#\fP\fIYOUR_USERNAME\fP"
815 .fi
816 .ad
817 .PP
818 Some mailers (notably exim) do not currently accept the above syntax.
819 In such case use this instead:
820 .PP
821 .na
822 .nf
823 |/usr/bin/procmail
824 .fi
825 .ad
826 .PP
827 Procmail can also be invoked to postprocess an already filled system
828 mailbox. This can be useful if you don't want to or can't use a
829 $HOME/.forward file (in which case the following script could
830 periodically be called from within
831 .BR cron (1),
832 or whenever you start reading mail):
833 .Sx 17
834 #!/bin/sh
835
836 ORGMAIL=/var/spool/mail/$LOGNAME
837
838 if cd $HOME &&
839 test \-s $ORGMAIL &&
840 lockfile \-r0 \-l1024 .newmail.lock 2>/dev/null
841 then
842 trap "rm \-f .newmail.lock" 1 2 3 13 15
843 umask 077
844 lockfile \-l1024 \-ml
845 cat $ORGMAIL >>.newmail &&
846 cat /dev/null >$ORGMAIL
847 lockfile \-mu
848 formail \-s procmail <.newmail &&
849 rm \-f .newmail
850 rm \-f .newmail.lock
851 fi
852 exit 0
853 .Ex
854 .ne 14
855 .SS "A sample small $HOME/.procmailrc:"
856 .na
857 .nf
858 PATH=/usr/local/bin:/bin:/usr/bin
859 MAILDIR=$HOME/Mail #you'd better make sure it exists
860 DEFAULT=$MAILDIR/mbox #completely optional
861 LOGFILE=$MAILDIR/from #recommended
862
863 :0:
864 * ^From.*berg
865 from_me
866
867 :0
868 * ^Subject:.*Flame
869 /dev/null
870 .fi
871 .ad
872 .PP
873 Other examples for rcfile recipes can be looked up in the
874 .BR procmailex (5)
875 man page.
876 .Sh SOURCE
877 This program is part of the
878 .I procmail mail-processing-package
879 (v3.24) available at http://www.procmail.org/ or
880 ftp.procmail.org in
881 .BR pub/procmail/ .
882 .Sh MAILINGLIST
883 There exists a mailinglist for questions relating to any program in the
884 procmail package:
885 .RS
886 <[email protected]>
887 .RS
888 for submitting questions/answers.
889 .RE
890 <[email protected]>
891 .RS
892 for subscription requests.
893 .RE
894 .PP
895 .RE
896 If you would like to stay informed about new versions and official patches send
897 a subscription request to
898 .RS
899 [email protected]
900 .RE
901 (this is a readonly list).
902 .SH AUTHORS
903 Stephen R. van den Berg
904 .RS
905 <[email protected]>
906 .RE
907 .\".if n .pl -(\n(.tu-1i)
908 .rm SH
909 .rn Sh SH
910 .rm SS
911 .rn Ss SS
912 .rm TP
913 .rn Tp TP
914 .rm RS
915 .rn Rs RS
916 .rm RE
917 .rn Re RE