procmail
[Top] [All Lists]

Re: Forwarding to Program-Generated Recipients

1997-02-23 15:56:15
At 12:23 PM 2/23/97 -0800, Roy Rapoport wrote:

Howdy, all.  Another question.

I need to set up an alias to address all our users who get their
access via another provider, internetmci.com.  What I'd like to do
is set up a procmail recipe so that mail hitting this recipe gets
forwarded to a recipient list created by a program that would just
parse through the aliases file and grep for these users.  

So far, I haven't seen a way to forward mail to an arbitrary,
program-generated mailing list.  Is this possible?

Anything wrong with the following?:

        :0
        * (...some conditions here...)
        ! `cat $HOME/program-generated-mailing-list`

1.  If 'grep' leaves other junk on the matching lines, pipe that output
through awk or perl to get just a list of destination addresses you want.
Put that list in $HOME/program-generated-mailing-list as here, or any other
filename you desire.

2.  To create that list, write it into some other filename in the same file
system, and then mv it to $HOME/program-generated-mailing-list if you can.
Otherwise, change the first line to ":0: some-lockfile" and use lockfile
to make sure that mail isn't being processed at the same time you're
writing to the file of addresses.

3.  If looping might be possible, add and check for the "X-Loop:" header as
shown in examples in the man pages.

4.  If you meant you want to parse the aliases file each time (probably a lot
slower), then use instead:
        :0
        * (...some conditions here...)
        ! `$HOME/myscript`
where $HOME/myscript emits the addresses you want to send to.  (The looping
considerations still apply here.)

Cheers,
Stan

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