procmail
[Top] [All Lists]

Re: Using procmail only as a filter, not MDA/MTA

2002-08-24 10:06:42
On Fri, 23 Aug 2002, tina long wrote:

How would I call procmail if I only want to use it purely as a filter,
and perhaps to modify headers?

I am also restricted by how I can call procmail: I can only specify a path 
in my callout to access procmail.

By this you mean, you can give *only* the path to the executable, with no
command line arguments?

The short answer to your first question is:

Call it the same way you'd call it for any other purpose, but make sure
the rc files don't include any delivering recipes.  At the beginning of
the first rc file, add the line:

DEFAULT='|'

That will cause procmail to emit the message on stdout again after it has
been processed.  It's guaranteed to read the entire message from stdin 
before producing any output on stdout.  There must be no other assignment
to DEFAULT anywhere in any rc file.

Longer answer:

"No delivering recipes" means that all recipes must have one of two forms:

:0
* conditions optionally here
{
  # nested recipes and/or variable assignments here
}

:0f
* conditions optionally here
| filter program here

There can be other flags besides `f', but there must always be `f', and 
there should never be `c'.

"The first rc file" depends on how procmail is invoked.  If run with no
arguments at all, it'll first read /etc/procmailrc, so that's where you
should put the DEFAULT setting (if you can, otherwise $HOME/.procmailrc
of the user procmail is running as).  If run with rcfiles named as its
command line arguments, it'll read them in order, so the first one of
those is where you should assign to DEFAULT.  Or, you can actually put
the DEFAULT assignment on the command line:

procmail DEFAULT='|' list of rc files here

or

procmail -m DEFAULT='|' rcfile other arguments here

So your restriction may mean that you have to write a shell script (or
perl program or whatever) to call procmail with the appropriate arguments,
and then give the path to that shell script to your SMTP server as the
filter name.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>