Seth Woolley's Man Viewer

procmail(1) - procmail - autonomous mail processor - man 1 procmail

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

PROCMAIL(1)                                                        PROCMAIL(1)



NAME
       procmail - autonomous mail(1,8) processor

SYNOPSIS
       procmail [-ptoY] [-f fromwhom]
            [parameter=value | rcfile] ...
       procmail [-toY] [-f fromwhom] [-a argument] ...
            -d recipient ...
       procmail [-ptY] -m [parameter=value] ...  rcfile
            [argument] ....br procmail -v

DESCRIPTION
       For a quick start, see NOTES at the end.

       Procmail  should be invoked automatically over the .forward file(1,n) mecha-
       nism as soon as mail(1,8) arrives.  Alternatively, when installed by a  sys-
       tem  administrator,  it  can  be invoked from within the mailer immedi-
       ately.  When invoked, it  first  sets  some  environment  variables  to
       default  values,  reads the mail(1,8) message from stdin until an EOF, sepa-
       rates the body from the header, and then, if(3,n) no command line  arguments
       are  present,  it  starts  to  look(1,8,3 Search::Dict) for a file(1,n) named(5,8) $HOME/.procmailrc.
       According to the processing recipes in(1,8) this file(1,n), the mail(1,8) message that
       just  arrived gets(3,n) distributed into the right folder (and more).  If no
       rcfile is found, or processing of the rcfile falls off the  end,  proc-
       mail(1,8) will store the mail(1,8) in(1,8) the default system mailbox.

       If  no rcfiles and no -p have been specified on the command line, proc-
       mail(1,8) will, prior to reading $HOME/.procmailrc, interpret commands  from
       /etc/procmailrc  (if(3,n)  present).   Care  must  be  taken  when  creating
       /etc/procmailrc, because, if(3,n) circumstances permit, it will be  executed
       with  root  privileges  (contrary  to  the  $HOME/.procmailrc  file(1,n)  of
       course).

       If running suid root or with root privileges, procmail will be able  to
       perform  as a functionally enhanced, backwards compatible mail(1,8) delivery
       agent.

       Procmail can also be used as a general purpose mail(1,8) filter(1,3x,3x curs_util), i.e.,  pro-
       visions  have  been  made to enable procmail to be invoked in(1,8) a special
       sendmail(1,8) rule.

       The rcfile format is described in(1,8) detail in(1,8) the procmailrc(5) man(1,5,7) page.

       The  weighted  scoring  technique  is  described in(1,8) detail in(1,8) the proc-
       mailsc(5) man(1,5,7) page.

       Examples for rcfile recipes can be looked up in(1,8) the  procmailex(5)  man(1,5,7)
       page.

   Signals
       TERMINATE   Terminate prematurely and requeue the mail.

       HANGUP      Terminate prematurely and bounce the mail.

       INTERRUPT   Terminate prematurely and bounce the mail.

       QUIT        Terminate prematurely and silently lose the mail.

       ALARM       Force a timeout(1,3x,3x cbreak) (see TIMEOUT).

       USR1        Equivalent to a VERBOSE=off.

       USR2        Equivalent to a VERBOSE=on.

OPTIONS
       -v   Procmail  will  print its version(1,3,5) number, display its compile time(1,2,n)
            configuration and exit.

       -p   Preserve any old environment.  Normally procmail clears the  envi-
            ronment upon startup, except for the value of TZ.  However, in(1,8) any
            case: any default values will override any preexisting environment
            variables, i.e., procmail will not pay any attention to any prede-
            fined environment variables, it will happily overwrite  them  with
            its  own  defaults.   For  the  list of environment variables that
            procmail will preset see the procmailrc(5) man(1,5,7) page.  If  both  -p
            and  -m  are  specified,  the list of preset environment variables
            shrinks to just: LOGNAME, HOME, SHELL, ORGMAIL and MAILDIR.

       -t   Make procmail fail softly, i.e., if(3,n) procmail  cannot  deliver  the
            mail(1,8)  to  any  of  the  destinations  you  gave, the mail(1,8) will not
            bounce, but will  return  to  the  mailqueue.   Another  delivery-
            attempt will be made at some time(1,2,n) in(1,8) the future.

       -f fromwhom
            Causes  procmail  to  regenerate  the  leading  `From  ' line with
            fromwhom as the sender (instead of -f one could use the  alternate
            and  obsolete  -r).   If fromwhom consists merely of a single `-',
            then procmail will only update(7,n) the timestamp on the `From  '  line
            (if(3,n) present, if(3,n) not, it will generate a new one).

       -o   Instead of allowing anyone to generate `From ' lines, simply over-
            ride the fakes.

       -Y   Assume traditional Berkeley mailbox format,  ignore  any  Content-
            Length: fields.

       -a argument
            This  will  set(7,n,1 builtins)  $1  to  be equal to argument.  Each succeeding -a
            argument will set(7,n,1 builtins) the next number variable ($2, $3, etc).  It  can
            be used to pass meta information along to procmail.  This is typi-
            cally done by passing along the $@x information from the  sendmail(1,8)
            mailer rule.

       -d recipient ...
            This  turns  on  explicit  delivery  mode, delivery will be to the
            local user recipient.  This, of course, only is possible if(3,n)  proc-
            mail(1,8)  has  root privileges (or if(3,n) procmail is already running with
            the recipient's euid and  egid).   Procmail  will  setuid  to  the
            intended recipients and delivers the mail(1,8) as if(3,n) it were invoked by
            the recipient with no arguments (i.e.,  if(3,n)  no  rcfile  is  found,
            delivery is like ordinary mail(1,8)).  This option is incompatible with
            -p.

       -m   Turns procmail into a general purpose mail(1,8) filter.  In  this  mode
            one  rcfile  must  be  specified  on  the command line.  After the
            rcfile, procmail will accept(2,8) an unlimited number of arguments.  If
            the  rcfile  is  an  absolute path starting with /etc/procmailrcs/
            without backward references (i.e. the parent directory  cannot  be
            mentioned)  procmail  will,  only  if(3,n)  no  security violations are
            found, take on the identity of the owner of the  rcfile  (or  sym-
            bolic  link(1,2)).   For  some advanced usage of this option you should
            look(1,8,3 Search::Dict) in(1,8) the EXAMPLES section  below..SH  ARGUMENTS  Any  arguments
            containing  an  '='  are  considered  to  be  environment variable
            assignments, they will all be evaluated after the  default  values
            have been assigned and before the first rcfile is opened.

       Any  other  arguments are presumed to be rcfile paths (either absolute,
       or if(3,n) they start with `./' relative to the current directory; any other
       relative  path  is  relative  to  $HOME,  unless the -m option has been
       given, in(1,8) which case all relative paths are  relative  to  the  current
       directory); procmail will start with the first one it finds on the com-
       mand line.  The following ones will only be  parsed  if(3,n)  the  preceding
       ones  have  a not matching HOST-directive entry, or in(1,8) case they should
       not exist.

       If no rcfiles are specified, it looks for  $HOME/.procmailrc.   If  not
       even  that  can  be  found,  processing  will continue according to the
       default settings of the environment variables and the ones specified on
       the command line.

EXAMPLES
       Examples  for  rcfile recipes can be looked up in(1,8) the procmailex(5) man(1,5,7)
       page.  A small sample rcfile can be found in(1,8) the NOTES section below.

       Skip the rest of this EXAMPLES section unless you are a system adminis-
       trator who is vaguely familiar with sendmail.cf syntax.

       The  -m  option is typically used when procmail is called from within a
       rule in(1,8) the sendmail.cf file.  In order to be able to  do  this  it  is
       convenient  to  create  an  extra `procmail' mailer in(1,8) your sendmail.cf
       file(1,n) (in(1,8) addition to the perhaps already present  `local'  mailer  that
       starts  up  procmail).   To create such a `procmail' mailer I'd suggest
       something like:

              Mprocmail, P=/usr/bin/procmail, F=mSDFMhun, S=11, R=21,
                      A=procmail -m $h $g $u

       This enables you to use rules like the following (most likely in(1,8)  rule-
       set(7,n,1 builtins)  0)  to  filter(1,3x,3x curs_util)  mail(1,8)  through the procmail mailer (please note the
       leading tab to continue the rule, and the  tab  to  separate  the  com-
       ments):

              R$*<@some.where>$*
                      $#procmail $@/etc/procmailrcs/some.rc $:$1@some.where.procmail$2
              R$*<@$*.procmail>$*
                      $1<@$2>$3       Already filtered, map back

       And /etc/procmailrcs/some.rc could be as simple as:

              SENDER = "<$1>"                 # fix for empty sender addresses
              SHIFT = 1                       # remove it from $@

              :0                              # sink all junk mail(1,8)
              * ^Subject:.*junk
              /dev/null

              :0 w                            # pass along all other mail(1,8)
              ! -oi -f "$SENDER" "$@"

       Do watch out when sending mail(1,8) from within the /etc/procmailrcs/some.rc
       file(1,n), if(3,n) you send(2,n) mail(1,8) to addresses which match the first  rule  again,
       you could be creating an endless mail(1,8) loop.

FILES
       /etc/passwd(1,5)            to  set(7,n,1 builtins)  the recipient's LOGNAME, HOME and SHELL
                              variable defaults

       /var/spool/mail(1,8)/$LOGNAME
                              system mailbox; both the system mailbox and  the
                              immediate  directory  it  is  in(1,8) will be created
                              every time(1,2,n) procmail starts and either one is not
                              present

       /etc/procmailrc        initial global rcfile

       /etc/procmailrcs/      special privileges path for rcfiles

       $HOME/.procmailrc      default rcfile

       /var/spool/mail(1,8)/$LOGNAME.lock
                              lockfile  for  the system mailbox (not automati-
                              cally used by procmail, unless  $DEFAULT  equals
                              /var/spool/mail(1,8)/$LOGNAME  and procmail is deliv-
                              ering to $DEFAULT)

       /usr/sbin/sendmail(1,8)     default mail(1,8) forwarder

       _????`hostname`        temporary `unique' zero-length files created  by
                              procmail

SEE ALSO
       procmailrc(5), procmailsc(5), procmailex(5), sh(1), csh(1), mail(1,8)(1),
       mailx(1), binmail(1), uucp(1), aliases(5), sendmail(1,8)(8), egrep(1),
       grep(1), biff(1), comsat(8), lockfile(1), formail(1), cron(1)

DIAGNOSTICS
       Autoforwarding mailbox found
                              The system mailbox had its suid or sgid bit set(7,n,1 builtins),
                              procmail terminates with EX_NOUSER assuming that
                              this mailbox must not be delivered to.

       Bad substitution of "x"
                              Not a valid environment variable name specified.

       Closing brace unexpected
                              There was no corresponding opening brace  (nest-
                              ing block).

       Conflicting options    Not all option combinations are useful

       Conflicting x suppressed
                              Flag x is not compatible with some other flag on
                              this recipe.

       Couldn't create "x"    The  system  mailbox  was  missing   and   could
                              not/will not be created.

       Couldn't create maildir(1,5) part "x"
                              The  maildir(1,5)  folder  "x" is missing one or more
                              required subdirectories and procmail  could  not
                              create them.

       Couldn't create or rename(1,2,n) temp file(1,n) "x"
                              An  error(8,n) occurred in(1,8) the mechanics of  deliver-
                              ing to the directory folder "x".

       Couldn't determine implicit lockfile from "x"
                              There were no `>>' redirectors to be found,  us-
                              ing simply `$LOCKEXT' as locallockfile.

       Couldn't read(2,n,1 builtins) "x"      Procmail  was unable to open(2,3,n) an rcfile or it was
                              not a regular file(1,n), or procmail couldn't open(2,3,n) an
                              MH  directory to find the highest numbered file.

       Couldn't unlock "x"    Lockfile was already gone, or  write(1,2)  permission
                              to  the directory where the lockfile is has been
                              denied.

       Deadlock attempted on "x"
                              The locallockfile specified on  this  recipe  is
                              equal to a still active $LOCKFILE.

       Denying special privileges for "x"
                              Procmail  will  not  take  on  the identity that
                              comes with the rcfile because a security  viola-
                              tion was found (e.g.  -p or variable assignments
                              on the command line) or  procmail  had  insuffi-
                              cient privileges to do so.

       Descriptor "x" was not open(2,3,n)
                              As procmail was started, stdin, stdout or stderr
                              was not connected (possibly an attempt  to  sub-
                              vert security)

       Enforcing stricter permissions on "x"
                              The system mailbox of the recipient was found to
                              be unsecured, procmail secured it.

       Error while writing to "x"
                              Nonexistent subdirectory, no  write(1,2)  permission,
                              pipe(2,8) died or disk full.

       Exceeded LINEBUF       Buffer overflow detected, LINEBUF was too small,
                              PROCMAIL_OVERFLOW has been set.

       MAILDIR is not an absolute path

       MAILDIR path too long

       ORGMAIL is not an absolute path

       ORGMAIL path too long

       default rcfile is not an absolute path

       default rcfile path too long
                              The specified item's full path,  when  expanded,
                              was  longer  than LINEBUF or didn't start with a
                              file(1,n) separator.

       Excessive output quenched from "x"
                              The program or filter(1,3x,3x curs_util) "x" tried to  produce  too
                              much  output  for  the current LINEBUF, the rest
                              was discarded  and  PROCMAIL_OVERFLOW  has  been
                              set.

       Extraneous x ignored   The  action  line  or other flags on this recipe
                              makes flag x meaningless.

       Failed forking "x"     Process table is full (and NORESRETRY  has  been
                              exhausted).

       Failed to execute "x"  Program not in(1,8) path, or not executable.

       Forced unlock denied on "x"
                              No write(1,2) permission in(1,8) the directory where lock-
                              file(1,n) "x" resides, or more than one procmail try-
                              ing to force a lock at exactly the same time.

       Forcing lock on "x"    Lockfile "x" is going to be removed by force be-
                              cause of a timeout(1,3x,3x cbreak) (see also: LOCKTIMEOUT).

       Incomplete recipe      The start of a recipe was found, but it stranded
                              in(1,8) an EOF.

       Insufficient privileges
                              Procmail  either  needs root privileges, or must
                              have the right (e)uid and (e)gid to run  in(1,8)  de-
                              livery mode.  The mail(1,8) will bounce.

       Invalid regexp(3,n) "x"     The regular expression "x" contains errors (most
                              likely some missing or extraneous parens).

       Kernel-lock failed     While trying to use the kernel-supported locking
                              calls,  one of them failed (usually indicates an
                              OS error(8,n)), procmail ignores this error(8,n) and  pro-
                              ceeds.

       Kernel-unlock failed   See above.

       Lock failure on "x"    Can  only  occur  if(3,n) you specify some real weird
                              (and illegal) lockfilenames or if(3,n)  the  lockfile
                              could  not  be  created  because of insufficient
                              permissions or nonexistent subdirectories.

       Lost "x"               Procmail tried to clone  itself  but  could  not
                              find  back  rcfile "x" (it either got removed or
                              it was a relative path and you changed directory
                              since procmail opened it last time(1,2,n)).

       Missing action         The current recipe was found to be incomplete.

       Missing closing brace  A nesting block was started, but never finished.

       Missing name           The -f option needs an extra argument.

       Missing argument       You specified the -a option but forgot the argu-
                              ment.

       Missing rcfile         You  specified  the  -m option, procmail expects
                              the name of an rcfile as argument.

       Missing recipient      You specified the -d option or  called  procmail
                              under  a  different name, it expects one or more
                              recipients as arguments.

       No space left to finish writing "x"
                              The filesystem  containing  "x"  does  not  have
                              enough free space to permit delivery of the mes-
                              sage to the file.

       Out of memory          The system is out of swap space (and  NORESRETRY
                              has been exhausted).

       Processing continued   The unrecognised options on the command line are
                              ignored, proceeding as usual.

       Program failure (nnn) of "x"
                              Program that was started  by  procmail  returned
                              nnn instead of EXIT_SUCCESS (=0); if(3,n) nnn is neg-
                              ative, then this is the signal(2,7) the program  died
                              on.

       Quota exceeded while writing "x"
                              The  filesize  quota(1,8)  for  the  recipient on the
                              filesystem containing "x" does not permit deliv-
                              ering the message to the file.

       Renaming bogus "x" into "x"
                              The system mailbox of the recipient was found to
                              be bogus, procmail performed evasive actions.

       Rescue of unfiltered data succeeded/failed
                              A filter(1,3x,3x curs_util) returned unsuccessfully, procmail tried
                              to get back the original text.

       Skipped: "x"           Couldn't  do  anything  with  "x"  in(1,8) the rcfile
                              (syntax error(8,n)), ignoring it.

       Suspicious rcfile "x"  The owner of the rcfile was not the recipient or
                              root, the file(1,n) was world writable, or the direc-
                              tory that contained it was  world  writable,  or
                              this  was the default rcfile ($HOME/.procmailrc)
                              and either it was group writable or the directo-
                              ry that contained it was group writable (the rc-
                              file(1,n) was not used).

       Terminating prematurely whilst waiting for ...
                              Procmail received a signal(2,7) while it was  waiting
                              for ...

       Timeout, terminating "x"
                              Timeout has occurred on program or filter(1,3x,3x curs_util) "x".

       Timeout, was waiting for "x"
                              Timeout  has occurred on program, filter(1,3x,3x curs_util) or file(1,n)
                              "x".  If it was a program  or  filter(1,3x,3x curs_util),  then  it
                              didn't seem to be running anymore.

       Truncated file(1,n) to former size
                              The file(1,n) could not be delivered to successfully,
                              so the file(1,n) was truncated to its former size.

       Truncating "x" and retrying lock
                              "x" does not seem to be a valid filename or  the
                              file(1,n) is not empty.

       Unable to treat as directory "x"
                              Either  the suffix on "x" would indicate that it
                              should be an MH or maildir(1,5)  folder,  or  it  was
                              listed  as  an second folder into which to link(1,2),
                              but it already exists and is not a directory.

       Unexpected EOL         Missing closing quote, or trying to escape  EOF.

       Unknown user "x"       The  specified  recipient does not have a corre-
                              sponding uid.

EXTENDED DIAGNOSTICS
       Extended diagnostics can be turned on and off through setting the  VER-
       BOSE variable.

       [pid] time(1,2,n) & date      Procmail's pid and a timestamp.  Generated when-
                              ever procmail logs a diagnostic and at  least  a
                              second has elapsed since the last timestamp.

       Acquiring kernel-lock  Procmail  now  tries to kernel-lock the most re-
                              cently opened file(1,n) (descriptor).

       Assigning "x"          Environment variable assignment.

       Assuming identity of the recipient, VERBOSE=off
                              Dropping all  privileges  (if(3,n)  any),  implicitly
                              turns off extended diagnostics.

       Bypassed locking "x"   The  mail(1,8)  spool directory was not accessible to
                              procmail, it relied solely on kernel locks.

       Executing "x"          Starting program "x".  If it is started by proc-
                              mail(1,8)  directly  (without an intermediate shell),
                              procmail will show where it separated the  argu-
                              ments by inserting commas.

       HOST mismatched "x"    This  host(1,5)  was called "x", HOST contained some-
                              thing else.

       Locking "x"            Creating lockfile "x".

       Linking to "x"         Creating a hardlink between directory folders.

       Match on "x"           Condition matched.

       Matched "x"            Assigned "x" to MATCH.

       No match on "x"        Condition didn't match, recipe skipped.

       Non-zero exitcode (nnn) by "x"
                              Program that was started by procmail as a condi-
                              tion  or  as the action of a recipe with the `W'
                              flag returned nnn instead of EXIT_SUCCESS  (=0);
                              the usage indicates that this is not an entirely
                              unexpected condition.

       Notified comsat: "$LOGNAME@offset:file"
                              Sent comsat/biff a notice that mail(1,8) arrived  for
                              user $LOGNAME at `offset' in(1,8) `file(1,n)'.

       Opening "x"            Opening file(1,n) "x" for appending.

       Rcfile: "x"            Rcfile changed to "x".

       Reiterating kernel-lock
                              While attempting several locking methods, one of
                              these failed.   Procmail  will  reiterate  until
                              they all succeed in(1,8) rapid succession.

       Score: added newtotal "x"
                              This  condition scored `added' points, which re-
                              sulted in(1,8) a `newtotal' score.

       Unlocking "x"          Removing lockfile "x" again.

WARNINGS
       You should create a shell script that uses lockfile(1) before  invoking
       your  mail(1,8) shell on any mailbox file(1,n) other than the system mailbox (un-
       less(1,3) of course, your mail(1,8) shell uses the same lockfiles (local or glob-
       al) you specified in(1,8) your rcfile).

       In  the unlikely event that you absolutely need to kill(1,2,1 builtins) procmail before
       it has finished, first try and use the regular kill(1,2,1 builtins) command (i.e.,  not
       kill(1,2,1 builtins)  -9,  see  the subsection Signals for suggestions), otherwise some
       lockfiles might not get removed.

       Beware when using the -t option, if(3,n) procmail repeatedly  is  unable  to
       deliver  the  mail(1,8)  (e.g.,  due  to  an  incorrect  rcfile), the system
       mailqueue could fill up.  This could aggravate both the local  postmas-
       ter and other users.

       The  /etc/procmailrc file(1,n) might be executed with root privileges, so be
       very careful of what you put in(1,8) it.  SHELL will be equal to that of the
       current recipient, so if(3,n) procmail has to invoke the shell, you'd better
       set(7,n,1 builtins) it to some safe value first.  See also: DROPPRIVS.

       Keep in(1,8) mind that if(3,n) chown(1,2)(1) is permitted on files  in(1,8)  /etc/procmail-
       rcs/,  that  they can be chowned to root (or anyone else) by their cur-
       rent owners.  For maximum security, make sure this  directory  is  exe-
       cutable to root only.

       Procmail  is  not  the  proper  tool for sharing one mailbox among many
       users(1,5), such as when you have one POP account for all mail(1,8) to  your  do-
       main.  It  can  be done if(3,n) you manage to configure your MTA to add some
       headers with the envelope recipient data in(1,8) order to tell Procmail  who
       a  message is for, but this is usually not the right thing to do.  Per-
       haps you want to investigate if(3,n) your MTA offers `virtual(5,8) user  tables',
       or check out the `multidrop' facility of Fetchmail.

BUGS
       After removing a lockfile by force, procmail waits $SUSPEND seconds be-
       fore creating a new lockfile so that another process  that  decides  to
       remove  the  stale  lockfile  will not remove the newly created lock by
       mistake.

       Procmail uses the regular TERMINATE signal(2,7)  to  terminate  any  runaway
       filter(1,3x,3x curs_util), but it does not check if(3,n) the filter(1,3x,3x curs_util) responds to that signal(2,7) and
       it only sends it to the filter(1,3x,3x curs_util) itself, not to any of the filter(1,3x,3x curs_util)'s chil-
       dren.

       A continued Content-Length: field is not handled correctly.

       The  embedded  newlines  in(1,8)  a  continued header should be skipped when
       matching instead of being treated as a single space as they are now.

MISCELLANEOUS
       If there is an existing Content-Length: field in(1,8) the header of the mail(1,8)
       and the -Y option is not specified, procmail will trim the field to re-
       port the correct size.  Procmail does not change the fieldwidth.

       If there is no Content-Length: field or the -Y option has  been  speci-
       fied and procmail appends to regular mailfolders, any lines in(1,8) the body
       of the message that look(1,8,3 Search::Dict) like postmarks are prepended with `>' (disarms
       bogus  mailheaders).  The regular expression that is used to search for
       these postmarks is:
              `\nFrom '

       If the destination name used  in(1,8)  explicit  delivery  mode  is  not  in(1,8)
       /etc/passwd(1,5), procmail will proceed as if(3,n) explicit delivery mode was not
       in(1,8) effect.  If not in(1,8) explicit delivery mode and should the  uid  proc-
       mail(1,8)  is  running  under, have no corresponding /etc/passwd(1,5) entry, then
       HOME will default to /, LOGNAME will default to #uid,  SHELL  will  de-
       fault to /bin/sh, and ORGMAIL will default to /tmp/dead.letter.

       When  in(1,8) explicit delivery mode, procmail will generate a leading `From
       ' line if(3,n) none is present.  If one is  already  present  procmail  will
       leave  it intact.  If procmail is not invoked with one of the following
       user or group ids: root,  daemon,  uucp,  mail(1,8),  x400,  network,  list,
       slist, lists or news, but still has to generate or accept(2,8) a new `From '
       line, it will generate an additional `>From ' line to help  distinguish
       fake mails.

       For  security reasons procmail will only use an absolute or $HOME-rela-
       tive rcfile if(3,n) it  is  owned  by  the  recipient  or  root,  not  world
       writable,  and  the directory it is contained in(1,8) is not world writable.
       The $HOME/.procmailrc file(1,n) has the additional constraint of  not  being
       group-writable or in(1,8) a group-writable directory.

       If  /var/spool/mail(1,8)/$LOGNAME  is a bogus mailbox (i.e., does not belong
       to the recipient, is unwritable, is a symbolic link(1,2) or is a hard link(1,2)),
       procmail  will  upon startup try to rename(1,2,n) it into a file(1,n) starting with
       `BOGUS.$LOGNAME.' and ending in(1,8) an inode-sequence-code.  If this  turns
       out  to  be  impossible,  ORGMAIL will have no initial value, and hence
       will inhibit delivery without a proper rcfile.

       If /var/spool/mail(1,8)/$LOGNAME already is a valid mailbox, but has got too
       loose  permissions on it, procmail will correct this.  To prevent proc-
       mail(1,8) from doing this make sure the u+x bit is set.

       When delivering to directories, MH folders,  or  maildir(1,5)  folders,  you
       don't  need  to  use  lockfiles to prevent several concurrently running
       procmail programs from messing up.

       Delivering to MH folders is slightly more time(1,2,n) consuming than  deliver-
       ing  to normal directories or mailboxes, because procmail has to search
       for the next available number (instead of having the  filename  immedi-
       ately available).

       On  general failure procmail will return EX_CANTCREAT, unless option -t
       is specified, in(1,8) which case it will return EX_TEMPFAIL.

       To make `egrepping' of headers more consistent,  procmail  concatenates
       all  continued header fields; but only internally.  When delivering the
       mail(1,8), line breaks will appear as before.

       If procmail is called under a name not starting with `procmail'  (e.g.,
       if(3,n)  it  is  linked to another name and invoked as such), it comes up in(1,8)
       explicit delivery mode, and expects the recipients'  names  as  command
       line arguments (as if(3,n) -d had been specified).

       Comsat/biff  notifications  are done using udp.  They are sent off once
       when procmail generates the regular logfile  entry.   The  notification
       messages have the following extended format (or as close(2,7,n) as you can get
       when final delivery was not to a file(1,n)):
              $LOGNAME@offset_of_message_in_mailbox:absolute_path_to_mailbox

       Whenever procmail itself opens a file(1,n) to deliver  to,  it  consistently
       uses  the  following  kernel locking strategies: fcntl(2), lockf(3) and
       flock(1,2)(2).

       Procmail is NFS-resistant and eight-bit clean.

NOTES
       Calling up procmail with the -h or -? options will cause it to  display
       a command-line help and recipe flag quick-reference page.

       There exists an excellent newbie FAQ about mailfilters (and procmail in(1,8)
       particular); it is maintained by Nancy McGough <nancym@ii.com> and  can
       be obtained by sending a mail(1,8) to mail-server@rtfm.mit.edu with the fol-
       lowing in(1,8) the body:
              send(2,n) usenet/news.answers/mail(1,8)/filtering-faq

       Instead of using the system provided invocation of procmail  when  mail(1,8)
       arrives,  you can control the invocation of procmail yourself.  In this
       case your $HOME/.forward (beware, it has to  be  world  readable)  file(1,n)
       should  contain the line below.  Be sure to include the single and dou-
       ble quotes, and unless you know your site  to  be  running  smrsh  (the
       SendMail Restricted SHell), it must be an absolute path.

       "|exec(3,n,1 builtins) /usr/bin/procmail"

       Procmail  can  also  be invoked to postprocess an already filled system
       mailbox.  This can be useful if(3,n) you  don't  want  to  or  can't  use  a
       $HOME/.forward  file(1,n) (in(1,8) which case the following script could periodi-
       cally be called from within cron(1),  or  whenever  you  start  reading
       mail(1,8)):

              #!/bin/sh

              ORGMAIL=/var/spool/mail(1,8)/$LOGNAME

              if(3,n) cd $HOME &&
               test -s $ORGMAIL &&
               lockfile -r0 -l1024 .newmail.lock 2>/dev/null
              then
                trap "rm -f .newmail.lock" 1 2 3 13 15
                umask 077
                lockfile -l1024 -ml
                cat $ORGMAIL >>.newmail &&
                 cat /dev/null >$ORGMAIL
                lockfile -mu
                formail -s procmail <.newmail &&
                 rm -f .newmail
                rm -f .newmail.lock
              fi
              exit(3,n,1 builtins) 0


   A sample small $HOME/.procmailrc:
       PATH=/bin:/usr/bin:/usr/bin
       MAILDIR=$HOME/Mail      #you'd better make sure it exists
       DEFAULT=$MAILDIR/mbox   #completely optional
       LOGFILE=$MAILDIR/from   #recommended

       :0:
       * ^From.*berg
       from_me

       :0
       * ^Subject:.*Flame
       /dev/null

       Other examples for rcfile recipes can be looked up in(1,8) the procmailex(5)
       man(1,5,7) page.

SOURCE
       This program is part of the  procmail  mail-processing-package  (v3.22)
       available  at http://www.procmail.org/ or ftp.procmail.org in(1,8) pub/proc-
       mail(1,8)/.

MAILINGLIST
       There exists a mailinglist for questions relating to any program in(1,8) the
       procmail package:
              <procmail-users@procmail.org>
                     for submitting questions/answers.
              <procmail-users-request@procmail.org>
                     for subscription requests.

       If  you  would  like  to  stay informed about new versions and official
       patches send(2,n) a subscription request to
              procmail-announce-request@procmail.org
       (this is a readonly list).

AUTHORS
       Stephen R. van den Berg
              <srb@cuci.nl>
       Philip A. Guenther
              <guenther@sendmail.com>



BuGless                           2001/08/27                       PROCMAIL(1)

References for this manual (incoming links)