procmail
[Top] [All Lists]

Re: Assigning variables, $MATCH and LOG

2000-03-16 04:57:31
On Thu, 16 Mar 2000, Ralph Seberry wrote:


Martin Mokrejs wrote:
      :0 H
      * ^Subject:[     ]*BOUNCE.*Non-member.*submission.*from.*\[\/.*
      {
              ODESILATEL = "$MATCH"
              LOG = "Odesilatel1 je $MATCH
"
      }
How can I modify the recipe above (after it starts working) so that it
grabs silhand(_at_)feld(_dot_)cvut(_dot_)cz ?

:0 H
* ^Subject:[     ]*BOUNCE.*Non-member.*submission.*from.*\[\/[^\]]*
{
  ODESILATEL="$MATCH"
  LOG="Odesilatel1 je $MATCH
"
}

(instead of ".*", tell it to get all characters up to ']' by using "[^\]]*")

Hmm, procmail says it matches but the variable is empty.
How does the \/ work? Does the match contain everything on the right side
from \/ or everything on the right side from \/ untill "[^\]]*" is
reached?


Could someone please shed a light on these following recipes? Especially,
meaning of plus at the end, the scoring example reading Delivered-To:
field ...


:0 # why do we need $ on the next line, where is variable expansion?
*$ ^Subject:[       ]+\[.*\][       ]+\/.+
| formail -I"Subject: $MATCH"


:0 # here we need $ on the next line to expand $TAG variable, am I right?
* $ ^Subject:(.*\<)?$\TAG\>
{
 LEFTSIDE
 :0 # pull out Re: or variants
 * ^Subject:[  ]*\/R[^         :]+:
 { LEFTSIDE="$MATCH " } # or { LEFTSIDE="Re: " } to make them uniform

 :0: # empty match is acceptable
 * ^Subject:.*$\TAG[   ]*\/([^         ].*)?
 | formail -i"Subject: $LEFTSIDE${MATCH:-empty subject}" >> $FOLDER
}


:0
* ^Delivered-To:[       ]+redirect-\/[^(_at_)]+
! $MATCH(_at_)newdomain(_dot_)com


:0 # what's the difference compared to previous recipe?
* $ 1^1 ^Delivered-To: domain.com.\/[^(_at_)]+
! $MATCH(_at_)newdomain(_dot_)com


:0 
* ^TO_(freebsd-)?\/(security|isdn|ports|questions|current|\
                    announce|stable|hackers)@freebsd.org
* MATCH ?? ^^\/[^(_at_)]+
$HOME/Mail/$MATCH



And finally, to my problem:

# why doesn't he recipe match this string:
["David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    (fwd)
# I want to extract
"David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>
* MATCH ?? \[\/[^]].*

The log file shows:
procmail: Skipped "* MATCH ?? \[\/[^]].*"

TIA
--
Martin Mokrejs - PGP 5.0i key at: finger://mail.natur.cuni.cz/mmokrejs
<mmokrejs(_at_)natur(_dot_)cuni(_dot_)cz> Faculty of Science, The Charles 
University