procmail
[Top] [All Lists]

Re: How to feed outgoing mail to procmail

1998-01-14 17:48:43
Vikas Agnihotri <VikasA(_at_)att(_dot_)com> writes:
If your MUA uses sendmail then, simply replace sendmail by the following
wrapper script:

procmail Procmailrc

In Procmailrc, put the following

## All your recipes. Make sure that they dont deliver yet. Just keep
## outputting to stdout.

# This will pipe your mail to  the REAL sendmail. Voila!
:0
! -t

In my experience it's better to call procmail in filter mode (-m) and
then pass the other arguments directly to sendmail with "$@".  Thus,
the wrapper would look like:

        #!/bin/sh
        procmail -m $HOME/.procmailrc.outgoing "$@"

Then your .procmailrc.outgoing would look like:

        MAILDIR = Mail
        # save a copy
        :0 c
        Out

        # Other processing...
        INCLUDERC = .procmailrc.reclusive

        :0 fh
        * ^TO_procmail@
        | formail -I"Reply-To: 
procmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de"

        :0
        ! "$@"


That way, if your MUA has recipients that don't appear in the header
(MH can do this if told, for example), they'll still get the message.
Note that if your MUA tries to call sendmail with the "-t" flag,
this'll still work.

This is really just another case of keeping the envelope distinguished
from the header.


Philip Guenther

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