procmail
[Top] [All Lists]

Re: another virus for your checker

2003-09-27 09:52:15
Dallman asked,

Confession time: I've never used the -m, and only have the
vaguest idea what turning "procmail into a general purpose
mail filter" is supposed to mean (see "man procmail"); or
why I might want to.  I know that what I used above skips
any /etc/procmailrc, too.  Can someone explain -m better than
the man pages do?

-m leaves ORGMAIL unset, skips the sanity check on $ORGMAIL, does pre-set DEFAULT (to what $ORGMAIL would have been), defaults MAILDIR to the cwd of the invocation rather than defaulting it to $HOME, and passes its remaining positional parameters (after -m, any command-line variable assignments, and one rcfile) to the rcfile as "$@" with their count as $#.

I've found it useful for wedging into outgoing mail if your MUA allows it. Instead of letting the mail client invoke the MTA directly, you can do some massaging by making it call procmail -m instead. Then when procmail is done with its filtering and logging, it can pass the message to the MTA for actual dispatch if the rcfile ends this way:

 :0
 ! "$@"

That way procmail invokes the MTA with the same positional parameters with which the MUA would have invoked it.

-m also (I've never done this) is useful when procmail is at the start or in the middle of a pipeline. Just toss

 DEFAULT=|

at the start of the rcfile and procmail will pass its output to the next command in the pipeline. Why would you put procmail there? For conditional filtering or logging based on content, I'd guess. You could do that without -m, but when you know you don't want mail saved to $ORGMAIL -m has the efficiency of skipping the sanity check and of not writing to $ORGMAIL if the save to $DEFAULT fails.


_______________________________________________
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>