This is the command procmail that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator
PROGRAM:
NAME
procmail - autonomous mail processor
SYNOPSIS
procmail [-ptoY] [-f fromwhom]
[parameter=value | rcfile] ...
procmail [-toY] [-f fromwhom] [-a argument] ...
-d recipient ...
procmail [-ptY] -m [parameter=value] ... rcfile
[argument] ...
procmail -v
DESCRIPTION
For a quick start, see NOTES at the end.
Procmail should be invoked automatically over the .forward file mechanism as soon as mail
arrives. Alternatively, when installed by a system administrator, it can be invoked from
within the mailer immediately. When invoked, it first sets some environment variables to
default values, reads the mail message from stdin until an EOF, separates the body from
the header, and then, if no command line arguments are present, it starts to look for a
file named $HOME/.procmailrc. According to the processing recipes in this file, the mail
message that just arrived gets distributed into the right folder (and more). If no rcfile
is found, or processing of the rcfile falls off the end, procmail will store the mail in
the default system mailbox.
If no rcfiles and no -p have been specified on the command line, procmail will, prior to
reading $HOME/.procmailrc, interpret commands from /etc/procmailrc (if present). 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).
If running suid root or with root privileges, procmail will be able to perform as a
functionally enhanced, backwards compatible mail delivery agent.
Procmail can also be used as a general purpose mail filter, i.e., provisions have been
made to enable procmail to be invoked in a special sendmail rule.
The rcfile format is described in detail in the procmailrc(5) man page.
The weighted scoring technique is described in detail in the procmailsc(5) man page.
Examples for rcfile recipes can be looked up in the procmailex(5) man 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 (see TIMEOUT).
USR1 Equivalent to a VERBOSE=off.
USR2 Equivalent to a VERBOSE=on.
OPTIONS
-v Procmail will print its version number, display its compile time configuration and
exit.
-p Preserve any old environment. Normally procmail clears the environment upon startup,
except for the value of TZ. However, in any case: any default values will override
any preexisting environment variables, i.e., procmail will not pay any attention to
any predefined 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 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 procmail cannot deliver the mail to any of the
destinations you gave, the mail will not bounce, but will return to the mailqueue.
Another delivery-attempt will be made at some time in 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 the timestamp on the `From '
line (if present, if not, it will generate a new one).
-o Instead of allowing anyone to generate `From ' lines, simply override the fakes.
-Y Assume traditional Berkeley mailbox format, ignore any Content-Length: fields.
-a argument
This will set $1 to be equal to argument. Each succeeding -a argument will set the
next number variable ($2, $3, etc). It can be used to pass meta information along to
procmail. This is typically done by passing along the $@x information from the
sendmail 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 procmail has root privileges (or if procmail is
already running with the recipient's euid and egid). Procmail will setuid to the
intended recipients and delivers the mail as if it were invoked by the recipient with
no arguments (i.e., if no rcfile is found, delivery is like ordinary mail). This
option is incompatible with -p.
-m Turns procmail into a general purpose mail filter. In this mode one rcfile must be
specified on the command line. After the rcfile, procmail will accept 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 no security violations are found, take on the
identity of the owner of the rcfile (or symbolic link). For some advanced usage of
this option you should look in the EXAMPLES section below.
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 they start
with `./' relative to the current directory; any other relative path is relative to $HOME,
unless the -m option has been given, in which case all relative paths are relative to the
current directory); procmail will start with the first one it finds on the command line.
The following ones will only be parsed if the preceding ones have a not matching HOST-
directive entry, or in 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 the procmailex(5) man page. A small
sample rcfile can be found in the NOTES section below.
Skip the rest of this EXAMPLES section unless you are a system administrator who is
vaguely familiar with sendmail.cf syntax.
The -m option is typically used when procmail is called from within a rule in the
sendmail.cf file. In order to be able to do this it is convenient to create an extra
`procmail' mailer in your sendmail.cf file (in 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 ruleset 0) to filter mail
through the procmail mailer (please note the leading tab to continue the rule, and the tab
to separate the comments):
R$*<@some.where>$*
$#procmail $@/etc/procmailrcs/some.rc $:$[email protected]$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
* ^Subject:.*junk
/dev/null
:0 w # pass along all other mail
! -oi -f "$SENDER" "$@"
Do watch out when sending mail from within the /etc/procmailrcs/some.rc file, if you send
mail to addresses which match the first rule again, you could be creating an endless mail
loop.
Use procmail online using onworks.net services