procmail
[Top] [All Lists]

RE: How do I capture the value of the TO header in my procmail log?

2008-06-23 11:57:17
S.A. Birl wrote Monday, June 23, 2008 6:59 PM:

I did something similar for Return-Path for logging:

:0
* ^Return-Path:[${WS}]*\/.*
{
        RETURNPATH=$MATCH
}

FYI, your use of $WS there will do absolutely nothing.
It's as if it weren't there.  I'll bet you have whitespace
at the start of most all your captured strings.

 8:48pm [~/Mail] 22[0]> cat rc

 VERBOSE = n
 DEFAULT = /dev/null

 WS = '  '  # a tab and a space


   :0
   * ^Return-Path:[$WS]*\/.*
   { }

   LOG = "This is Return-Path: >$MATCH<
"

 8:49pm [~/Mail] 23[0]> procmail -m rc < $SPAMPLE
This is Return-Path: > <Danielsijie(_at_)wanadoo(_dot_)fr><

See the space after the ">" above?

You want this instead, if your goal is not to 
capture the leading space:

   * ^Return-Path:.*\/[^$WS].*

The reason is that procmail matches as little as it possibly
can to fulfill the requirement of the regex you provide.
"Zero-or-more spaces" will be fulfilled with a match of zero
spaces in your regex, because you allow anything at all after
the match token.

Dallman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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