Ruud H.G. van Tol wrote:
[...]
It's easy to do that with 'just procmail'.
Ah, I suspected as much. If my mis-interpretation of '\<' wasn't a
giveaway, I'm fond of shell scripts. I realize I probably call external
programs more than necessary.
Suppose that MATCH can have values such as the ones jou mention:
listname(_at_)yahoogroups(_dot_)com - for the 1st
<mailto:listname-unsubscribe@ - for the 3rd
Just to clarify: Thanks to Chuck's hint, I'm now getting ONE good solid
$MATCH for each list. For example, for this list I have:
discussion of the procmail program <procmail.lists.RWTH-Aachen.DE>
Other examples:
"SpamAssassin Users" <users(_at_)spamassassin(_dot_)apache(_dot_)org>
SURBL Discussion list <discuss.lists.surbl.org>
BLU general discussion list <discuss.blu.org>
The actual matched strings vary widely (a potential problem for the
regex-challenged, myself included.)
Create a variable match2folder:
match2folder = "
${TAB}listname(_at_)yahoogroups(_dot_)com${TAB}<mailto:listname-unsubscribe(_at_)${TAB}folder1
${TAB}otherlist(_at_)yahoogroups(_dot_)com${TAB}<mailto:otherlist-unsubscribe(_at_)${TAB}folder2
"
One concern I have is about the sheer size of match2folder if I'm
subscribed to dozens of lists, especially many with verbose List-Id:s.
Are there limits on the size of environment variables shell dependent,
or are there procmail considerations to "really big" variables?
folder = "IN.list"
:0
*$ match2folder ?? ()${TAB}${MATCH}${TAB}.*\/[^${TAB}]+^
{ folder = $folder.$MATCH }
(untested)
Ah, so $MATCH is used, then changed to the last field. OK, I see how the
mapping occurs. Very nice!
Of course you can also first get the listname out of MATCH, convert it if
necessary, and then use it. That simplifies the match2folder definition.
I used md5sum route to reduce the sheer size of the matched string, but
I can do something just as effective with "only procmail" to
compress the matched string (i.e. delete spaces, take only
words.with.dots.between, or similar). This is more for MY sanity rather
than due to any procmail limitation. (Hmm... a hash function written in
procmail?)
I have a folder 'IN.list.tech' in which I deliver messages of
technical lists that I didn't give a specific folder. And an
'IN.list' that gets als list messages that are not redirected yet.
Very elegant, Ruud. I'll play around with getting the initial $MATCH
manageable and predictable (I suppose some might have embedded tabs) but
I see the path.
Thanks.
- Bob
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail