procmail
[Top] [All Lists]

Associative arrays in procmail recipes?

2002-12-24 05:56:41
Hello,

I know that there are several recipes, both in the archives of this
list and elsewhere, to do the following:

        if (From _or_ To _or_ Sender == [*]-list-admin(_at_)somewhere(_dot_)com)

        then save message to folder $1 (where $1 is the part in square
                                        brackets above)

This is *very* good because it spares from writing one recipe per
list. I want to do this, but...
Quite often I don't like the "official" list name. For example, I
would like to put messages from "list-post:
iscuss(_at_)openoffice(_dot_)org into an OOO folder, or stuff from
anaconda-devel-list-admin(_at_)redhat(_dot_)com into a "custom_redhat" folder.

In other words, I'd like a generic way to bind a generic string to an
unrelated one.
If this where Perl, I would build an associative array:

%FOLDER_NAMES = (
        'discuss(_at_)openoffice(_dot_)org', 'OOO',
        'anaconda-devel-list-admin(_at_)redhat(_dot_)com', 'custom_redhat',

        .....
);

and change the "save message to folder" line above to:

        save message to folder $FOLDER_NAMES{$1}

How do I do this in procmail? (Some days ago I *did* search with google
both in the archives and on the Internet, to no avail)

        TIA, and of course Merry Christmas

                Marco Fioretti

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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