procmail
[Top] [All Lists]

Re: get the subject as a variable for an condition

1997-02-03 14:01:57
"van 't Hoff" <erikh(_at_)rdc(_dot_)nl> writes:
i have procmail installed on a unix system.

and now I want to get the subject into a variable and use 
that variable as an input of an condition such as mkdir variable.

How can i get the subject in that variable and how do i use that
variable?

Clearly you're going to put some constraints on what messages cause these
directories to be made, or do you want to have a directory named

        "Re: get the subject as a variable for an condition"

However, even with those constraints you should put some limits on what
characters are allowed in the directory name.  In particular, you
definately don't want someone else to be creating directories with
"../" in them (i.e., "../../../something_annoying"), just to keep
everything contained nicely.  Unless you need the ability for someone
to create subdirectories, I would suggest you simply require the
subject to only contain letters, numbers, minus, underbar and period.

:0 hi
* whatever other constraints you need
* ^Subject: *\/[-a-z0-9_.]+$
|mkdir $MATCH

The above will require the subject to have only one "word" in it:  the
name of the directory to be created.  You can require other things in
the Subject: line before the directory to be created by just adding
them to the condition:

* ^Subject: *some required text *\/[-a-z0-9_.]+$

Philip Guenther