procmail
[Top] [All Lists]

Re: Forwarding to multiple persons

1998-03-06 01:38:17
On Thu, 5 Mar 1998, Rob Vandeweyer wrote:
What should the script do: it should forward mail to different addresses
at @i-nieuws.vuurwerk.nl to different persons.

The answer depends a bit on how many forwards you have. If it's a small
number, something manageable like the four you gave in your example, this
script will do. It uses the 'c' flag to clone mail that has been forwarded
in the first three forwarding recipes. If any of those three recipes work,
then we set forwarded=yes. If the mail hasn't forwarded in the first
three, then the last forwarding recipe forwards. If the last fails, then
the mail ends up in the mailbox.

# Clone and forward.
        :0cw
        * ^TO_rob(_at_)i-nieuws(_dot_)vuurwerk(_dot_)nl
        ! robvdw(_at_)glo(_dot_)be

        :0a
        { forwarded=yes }

# Clone and forward.
        :0cw
        * ^TO_rik(_at_)i-nieuws(_dot_)vuurwerk(_dot_)nl
        ! riktheys(_at_)village(_dot_)uunet(_dot_)be

        :0a
        { forwarded=yes }

# Clone and forward.
        :0cw
        * ^TO_michiel(_at_)i-nieuws(_dot_)vuurwerk(_dot_)nl
        ! mvo(_at_)open(_dot_)net

        :0a
        { forwarded=yes }

# Forward all not yet delivered.
        :0w
        * ! forwarded ?? yes
        ! robvdw(_at_)glo(_dot_)be

        :0a
        { forwarded=yes }

# If one or more of the recipes above forwarded, then delete the clone.
        :0
        * forwarded ?? yes
        /dev/null

# Anything NOT forwarded yet goes to the default mailbox.

Now, if you have a lot of addresses to forward, then either your going to
go blind typing it all in or you'll need a different procmail approach.

David Hunt

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