procmail
[Top] [All Lists]

Re: Get extra arguments from subject line

1998-11-17 05:36:06
On Tue, 17 Nov 1998 19:08:47 +0800 (JST),
"Francis A. Vidal" <francis(_at_)usls(_dot_)edu> wrote:
On Tue, 17 Nov 1998, era eriksson wrote:
You want FILE="$MATCH.txt"
ahh... so this is the trick.
how about if the conditions are:
* ^Subject:.*get <dir> <number>
where <dir> and <number> are both variables (depending on the user)

What about it? It's slightly harder to pick apart so you're really
better off using a syntax like get dir/number instead. If that's not
acceptable, try this:

    :0
    * ^Subject:\<*get\<+\/[-a-zA-Z0-9_]+\<+[0-9]+
    * ! ^X-Loop: tambok(_at_)usls\(_dot_)edu
    {
        # MATCH contains "dirname basename-of-file"; pick it apart
        MATCHED=$MATCH
        :0
        * MATCHED ?? ^^\/[-a-zA-Z0-9_]+
        { dirname=$MATCH }
        :0
        * MATCHED ?? ()\<\/[0-9]+$
        { basename=$MATCH }

        :0h
        | ( formail -rt -A "X-Loop: tambok(_at_)usls(_dot_)edu" ; \ 
            cat - $HOME/$dirname/$basename.txt ) \
          | $SENDMAIL $SENDMAILFLAGS -t
    }

Your directory names should conform to the regular expression
[-a-zA-Z0-9_]+ -- in particular, note that this excludes period
characters in the directory name.

I prefer formail -rt over formail -r in the general case.

/* era */

-- 
.obBotBait: It shouldn't even matter whether    <http://www.iki.fi/~era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>

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