procmail
[Top] [All Lists]

Re: Assigning variables, $MATCH and LOG

2000-03-15 16:03:16
On Wed, 15 Mar 2000, Philip Guenther wrote:

VAR=$MATCH

It needs
VAR = $MATCH

Sorry, even worse, it needs:
VAR = "$MATCH"
otherwise it complained in log like:

So really only the last variable assignment is correct, not hose first
two?

Let's say this is the proper recipe I wanted, although I have not yet
what I wanted.
:0cH
* ^Subject:[     ]*BOUNCE.*Non-member.*submission.*from.*\[\/.*
ODESILATEL = "$MATCH"
LOG = "Odesilatel1 je $MATCH
"


Here's your problem: the action of a recipe must be one of the following

a) a mailbox delivery, with optional secondary folders allowed in some
   cases; or
b) a pipe action; or
c) a forwarding ('!' action); or
d) a variable-capture version of either (b) or (c), ala
     VAR=| command-here
   or
e) a nested block ('{')

Hmm, you are most probably right. ;-)

What about   ()  as an action? Is that empty command?

Variable assignments do not fit any of those.  However, you can use a
nested block that only contains variable assignments to do the same
thing.  So your receipe above should be writted:

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

Note that you *don't* want the 'c' flag then, as nested blocks are, by
themselves, never considered to be delivering recipes.

Great! Thank you.



I won't start new thread, so a similar question matching the Subject:?
;)  How can I match on $MATCH?

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

procmail: Assigning "ODESILATEL="David Silhan" 
<silhand(_at_)feld(_dot_)cvut(_dot_)cz>]
(fwd)"
procmail: Assigning "LOG=Odesilatel0 je "David Silhan"
<silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    (fwd)
"
Odesilatel0 je "David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    (fwd)
procmail: Skipped "* ODESILATEL ?? silhan\/.*"
procmail: Assigning "ODESILATEL2="David Silhan" 
<silhand(_at_)feld(_dot_)cvut(_dot_)cz>] (fwd)"
procmail: Skipped "* ODESILATEL ?? silhan\/.*"


How can I modify the recipe above (after it starts working) so that it
grabs silhand(_at_)feld(_dot_)cvut(_dot_)cz ?

Many thanks!
--
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