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