procmail
[Top] [All Lists]

Re: Create new mail with procmaily

1997-01-14 22:08:02
David W. Tamkin seems to have said:
Thomas Ihmann asked,
Just add the `h' flag:

 :0hc
 ! my_pager(_at_)paging(_dot_)com

retains the original subject but does not send a body.  You might want to
specify some conditions, though, so that you aren't paged for every single
piece of incoming mail.


        If I understand it correctly the default
        is to pass the header and the body to the 
        action (filter, file, or forward).  If one adds
        the 'h' or 'b' flags to the :0 line if affects
        which parts of the message are fed to the action
        and the 'H' and 'B' flags affect which parts are
        parsed by the various Condition lines.

        Thus:

                :0
                # feed the header to the conditions and the
                # full message to the action

                :0 B
                # feed the body through the conditions and
                # the full message to the action

                :0 Bh
                # fed the body through the conditions and
                # only the header through the action

                :0 H
                # same as first example -- this is the 
                # default

                :0 Bb
                # feed just the body through the conditions
                # and into the actions

        If I understand further it is possible to overide
        the flags on the :0 line for a given conditional
        using the '??' operator on a '*' line.  I gather
        this works like so:

                :0 B
                * H ?? !^TO_whoever
                * (rich quick)
                # search the header for "not To: whoever"
                # and the body for the phrase "rich quick"
                # feed header and body to the action.

        I also noticed something inscrutable about using
        variables before the ?? operator.  I didn't find
        any examples of this in procmailex (the only one
        there was using it to over-ride the :0 flags)

        Would that be something like:

                :0
                * $HOME ?? ^X-HomeDir:\/.*

        Matches any header with a X-HomDir line that matches
        my home directory environment variable?

        (this example seems lame since I can't think of a 
         safe, reasonable use for it).

         It also seems like I can do something like:

                :0
                * ? /path/to/some/script

        ... which apparently tells procmail to run the 
        external script or binary and use that program's
        exit status as the truth value for the whole line.
        Does procmail feed the header (H -- default) to 
        the external script?

        If that's true then:

                :0
                * ? /bin/egrep

        Would be almost identical to testing using the internal
        egrep.

        Sorry to be so pesky -- but this stuff isn't really
        clear from the docs and it takes a long time to 
        reverse engineer it through experimentation.  I'll
        be delighted to share anything that I do put together.


-- 
Jim Dennis,                                
info(_at_)mail(_dot_)starshine(_dot_)org
Proprietor,                          
consulting(_at_)mail(_dot_)starshine(_dot_)org
Starshine Technical Services              http://www.starshine.org