On 24 Dec, Marco Fioretti wrote:
| 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)
LIST_LOOKUP=":discuss(_at_)openoffice(_dot_)org:OOO:\
anaconda-devel-list-admin(_at_)redhat(_dot_)com:custom_redhat"
:0:
* your condition(s) that place(s) intended "key" in MATCH variable
* $ LIST_LOOKUP ?? :$MATCH:\/[^:]+
$MATCH
That's something I got from the list long ago, but don't recall where
credit is due.
--
Email address in From: header is valid * but only for a couple of days *
This is my reluctant response to spammers' unrelenting address harvesting
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail