procmail
[Top] [All Lists]

Re: How do I insert one or more [list] tags ...

1999-03-16 03:04:39
On Mon, 15 Mar 1999 17:09:17 -0600, "Bert Hiddink"
<hiddink(_at_)sipromicro(_dot_)com> wrote:
How do I insert one or more [list] tags 1,2,3, etc. into a 
message-body, then substitute these tags by 1.txt, 2.txt, 3.txt, etc 
and send this message to the corresponding e-mail address on the 
list?

This is beginning to sound like something you should be asking in
comp.unix.shell or something. What you describe could probably be done
fairly easily by a Perl script, too.

The [list] is a file that looks something like this:
hiddink(_at_)sipromicro(_dot_)com (1,3)
you(_at_)site(_dot_)com (2)
we(_at_)othersite(_dot_)net (1,2,3)

I'm not sure I like the format of this file, but here we go.

You probably want the file to be sorted on the tags. That way we can
create a custom message for each tag set and then mail that off to as
many people as we can fit on the command line, as soon as we encounter
the next tag. (The following script does not have this optimization,
though.)

#!/usr/local/bin/pseudoperl

while (<recipients.txt>)
{
    build a %hash of tags with @recipients in each bucket;
}
while (<STDIN>)
{
    @message = probably preprocess and index a little bit;
}
for (key %hash)
{
    @thismessage = &transform ($_, @message) >/tmp/file;
    while (somehow get a suitable number of recipients on sendmail's
        command line, and open a pipe to that. (xargs is your friend))
    {
        for (@thismessage) # not sure if you need an explicit loop here
        {
            print PIPE;
        }
    }
}
    
I'm probably stating the obvious here, but this is really no longer a
Procmail problem first and foremost.

/* era */

-- 
.obBotBait: It shouldn't even matter whether    <http://www.iki.fi/~era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>

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