procmail
[Top] [All Lists]

Re: What did I do wrong?

1997-08-22 11:20:02
wotan(_at_)netcom(_dot_)com wondered,

| But the following filter causes foo(_at_)bar messages.  What did I forget to
| do?
| 
| :0 wfi
| *^From:.*wotan
| *^Subject: post this
| |$HOME/bin/post1 > /dev/null

You forgot to give any text out of the filter back to procmail.  Since you
are directing standard output somewhere else (it's /dev/null, but the same
thing would happen if you were sending it to an ordinary file), the filter
hands blankness back to procmail.

I'm not sure exactly where, but something is making procmail restore the
lost From_ line (a filter through formail, perhaps, or a final disposition
that isn't in raw mode), and since it has nothing to determine a sender from,
it inserts "From foo(_at_)bar" with a timestamp, and of course there is no body.

If what you want to do is direct post1's standard ERROR to /dev/null to keep
it from appearing in the logfile but capture post1's standard output as the
new text for procmail to work on, and your setting of $SHELL is
sh-compatible, use

  :0 wfi
  *^From:.*wotan
  *^Subject: post this
  | $HOME/bin/post1 2> /dev/null

or with any shell (as this evades calling a shell),

  savelogfile=$LOGFILE
  LOGFILE
  :0 wfi
  *^From:.*wotan
  *^Subject: post this
  | $HOME/bin/post1
  LOGFILE=$savelogfile

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