procmail
[Top] [All Lists]

Re: When does one use the "f" flag on a recipe

1997-03-25 14:41:35
On Tue, 25 Mar 1997 12:54:28 -0800, "Simeon ben Nevel"
<Simeon(_dot_)Nevel(_at_)Schwab(_dot_)COM> wrote:
Under what conditions do you use the "f" flag?

It means, take the header (or the body, with the b flag, or both, with
hb) and stuff that into the pipe, and +replace+ whatever went in with
the output from the pipeline. 

In other words, the following will replace the message body with the single
line "You have been had.". Processing after this recipe continues as usual,
but the original message body is now replaced with this one-liner.

    :0fbw
    | echo "You have been had."

The w flag tells Procmail to ignore write errors to the pipe. If you try
this with a short enough message, Procmail never gets the chance to notice
the write error to the pipe, but the fact is that the echo doesn't read its
input and Procmail will "salvage" the original message body if it detects
this via a write error (and so the replacement will not happen after all). 

Contrast with the following, which will not touch the original message in
any way (and in fact not do anything useful; printing out messages while
delivering mail is not useful because no-one ever sees what is printed).

    :0b
    | echo "You have been had."

Examples where it is used:
(Re-)generating "From " lines by piping message thru formail
Pre-converting encoded MIME formats to 8-bit formats

Yes, this takes the input and transforms it into something else which is
then subsequently delivered or forwarded instead of what was originally in
the message. 

Examples where it is NOT used:
Appending the mail headers to a header log
Piping a digest thru formail to split it into a mail "folder"

These are different kinds of actions, not transforming but rather
transmitting the message (is that a good word here, transmitting? It gets
saved or forwarded somewhere).

Hope this helps,

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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