procmail
[Top] [All Lists]

Re: LOGFILE

1998-03-03 12:48:53
On Tue, 3 Mar 1998 12:30:35 -0600 (CST), Christopher Lindsey
<lindsey(_at_)ncsa(_dot_)uiuc(_dot_)edu> wrote:
<... quoting David Tamkin here, if memory serves: ...>
Terry Todd asked,
| Is there a way to have procmail store the "From: " line in the LOGFILE
| instead of the "From " line?
If you are willing to accept both the From: line *and* the From_ line in the
log, then there's an easy answer (note the use of apostrophes, NOT 
backticks):
TRAP='formail -XFrom:'
If you want to avoid the extra system call and don't need $MATCH for
anything else, you can do this too (the last line is my own for
archiving).
   :0 c:
   * ^From:\/.*
   Mail/archives/$DATE.in
   LOG="From: $MATCH"

Apart from the MATCH grabbing, David's approach is better. But you can
combine them:

    TRAP='echo "    $FROM"'
    :0
    * ^\/From:.*
    { FROM="$MATCH" }

    # ... your normal recipes here

The one beauty glitch that remains is that the From: line will appear
after the Folder: line. I added a number of spaces to make it look
more logical. 

/* era */

(Also note that David's recipe and mine will preserve the text "From:"
in front of the field. Nice to keep it apart from all the random other
stuff that +might+ appear in your log.)

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

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