On Fri, 30 Oct 1998 09:19:01 -0800 (PST), Jauder Ho
<jauderho(_at_)transmeta(_dot_)com> posted to comp.mail.imap:
First of all, all messages would be TO<list>@transmeta.com. It would be
great if procmail could take the output of ls or a file and yank out the
list names and use that as a location to deliver to a particular inbox.
One potential problem is that some (completely braindead, I'm quick to
note) software will force the local part of addresses to uppercase or
some other similar stupidity. (This is a violation of RFC822. Tell the
guys who wrote IBM's MTA.) David Tamkin has devised a clever hack to
fix this; I believe it's on Jari's Procmail tips page.
Other than that, this sounds fairly simple:
# Dummy string is important in order to neutralize last LF
# Output will be something like list1|list2|list3|... this is a dummy
LISTS=`ls $MAJORDOMODIR | tr '\012' '|'`" ... this is a dummy string"
:0
* $ ^TO_\/($LISTS)@transmeta\.com\>
{
:0 # Grab localpart of MATCH and deliver into that
* MATCH ?? ^^\/[^(_at_)]+
| mydeliver "$MATCH"
}
See below for a definition of mydeliver.
Additionally the inbox will not be created automatically and needs to
manually created if it doesn't exist..
Whoa. Now how do we know whether the list name is the name of a valid
list or not? What's the purpose of grabbing the output of ls if you
are going to accept any ole address?
1) mail to/cc foo(_at_)transmeta(_dot_)com comes in.
2) procmail figures out that this is a valid list name
3) check if mailbox exists, if not use mbxcreat +majordomo/<list>
4) if it does, use dmail +majordomo/<list>
mbxcreat and dmail are tools for manipulating imap folders. This way, the
archived mail can be accessible via imap public folders.
I would propose to lump together 3 and 4 in mydeliver. That way, you
won't forget to create the list mailbox in any of your recipes, and
you (potentially) avoid a lot of redundant code in your .procmailrc.
#!/bin/sh
PATH=what:ever:you:need:for:this:to:work
# Error checking: die in anguish if called without exactly one parameter
test -d $MAJORDOMODIR/"$1" || mbxcreat +majordomo/"$1"
dmail +majordomo/"$1"
This is untested, as usual :-)
/* era */
--
Bot Bait: It shouldn't even matter whether (`') Just (`') http://www.iki
I am a resident of the State of Washington \/ Married! \/ .fi/~era/