procmail
[Top] [All Lists]

Assigning variables, $MATCH and LOG

2000-03-15 14:15:03
Hello,
 for some reason I tried to handle some error messages. For testing
purposes I'm forwarding to myself just one of them. My intention is to
extract the e-mail address contained in Subject: line, i.e.
silhand(_at_)feld(_dot_)cvut(_dot_)cz . The message contains in header:

Return-Path: <mmokrejs>
Received: (from mmokrejs(_at_)localhost)
        by prfdec.natur.cuni.cz (8.9.3/8.9.3) id VAA04648;
        Wed, 15 Mar 2000 21:45:10 +0100 (MET)
Posted-Date: Wed, 15 Mar 2000 21:45:10 +0100 (MET)
Received-Date: Wed, 15 Mar 2000 21:45:10 +0100 (MET)
Date: Wed, 15 Mar 2000 21:45:09 +0100 (MET)
From: Martin Mokrejs <mmokrejs(_at_)natur(_dot_)cuni(_dot_)cz>
To: Martin Mokrejs <mmokrejs(_at_)natur(_dot_)cuni(_dot_)cz>
Subject: BOUNCE montana(_at_)mail(_dot_)natur(_dot_)cuni(_dot_)cz:    
Non-member submission from
 ["David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    (fwd)
Message-ID: 
<Pine(_dot_)OSF(_dot_)4(_dot_)10(_dot_)10003152145070(_dot_)26164-100000(_at_)prfdec(_dot_)natur(_dot_)cuni(_dot_)cz>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii


I tried several recipes and I "discovered" that procmail is really lost
if I try to assign variable with:
VAR=$MATCH

It needs
VAR = $MATCH

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

procmail: Skipped ""David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>] 
(fwd)"

I think it's because of those spaces.



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
"

procmail: Assigning "MATCH="
procmail: Matched ""David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    
(fwd)"
procmail: Match on "^Subject:[   ]*BOUNCE.*Non-member.*submission.*from.*\[\/.*"
procmail: Skipped "= "David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    
(fwd)"
procmail: Assigning "LASTFOLDER=ODESILATEL"
procmail: Opening "ODESILATEL"
procmail: Acquiring kernel-lock
procmail: Assigning "LOG=Odesilatel1 je "David Silhan" 
<silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    (fwd)
"
Odesilatel1 je "David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    (fwd)

--------------------------------------------------------------
Here are some improper trials, are they really so bad?
Is there any explanation for such weird behavior? ;-)

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

procmail: Assigning "MATCH="
procmail: Matched ""David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    
(fwd)"
procmail: Match on "^Subject:[   ]*BOUNCE.*Non-member.*submission.*from.*\[\/.*"
procmail: Assigning "LASTFOLDER=ODESILATEL="David Silhan" 
<silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    (fwd)"
procmail: Opening "ODESILATEL="David Silhan" 
<silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    (fwd)"
procmail: Acquiring kernel-lock
procmail: Assigning "LOG=Odesilatel1 je "David Silhan" 
<silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    (fwd)
"
Odesilatel1 je "David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>]    (fwd)

---------------------------------------------------------------
OK, they is really too much. I know procmail is said to concatenate all lines
in header field into one *LONG* line so we match again that.
But how did it match the second part of originally next line? I'm lost.

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


procmail: No match on "^Subject:[        ]*BOUNCE.*Non-member submission from 
\[\/.*"
procmail: Assigning "LOG=Odesilatel1 je 
<Pine(_dot_)OSF(_dot_)4(_dot_)10(_dot_)10003152145070(_dot_)26164-100000(_at_)prfdec(_dot_)natur(_dot_)cuni(_dot_)cz>
"
Odesilatel1 je 
<Pine(_dot_)OSF(_dot_)4(_dot_)10(_dot_)10003152145070(_dot_)26164-100000(_at_)prfdec(_dot_)natur(_dot_)cuni(_dot_)cz>

--------------------------------------------------------------

procmail v3.13.1 1999/04/05, Copyright (c) 1999, Stephen R. van den Berg
                                                        <srb(_at_)cuci(_dot_)nl>

Submit questions/answers to the procmail-related mailinglist by sending to:
        <procmail-users(_at_)procmail(_dot_)org>

And of course, subscription and information requests for this list to:
        <procmail-users-request(_at_)procmail(_dot_)org>

Locking strategies:     dotlocking, fcntl(), lockf(), flock()
Default rcfile:         $HOME/.procmailrc
Your system mailbox:    /var/spool/mail/mmokrejs

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

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