procmail
[Top] [All Lists]

Re: forwarding

1997-01-30 09:54:22
:0c:
* ^From.*someone
! address(_at_)otherhost(_dot_)com
:0a:
Someone

What I'm trying to accomplish is send a copy of the message to myself at 
another address while still keeping a copy in the folder called 
"Someone".  This works but I'd like to improve it a little.  Can it be 
simplified?  Can the "X-Loop:" header be added easily?  Thanks!

I'm not sure about simplifying it -- at the moment, you have the minimum 
required to make it do what you want.  There are a few changes I would make:

(1) You don't need a local lock file for a recipe that forwards to
    another address.  The first recipe should look like:

        :0c

(2) You have the second recipe depending on the *successful* completion 
    of the preceding recipe.  I would probably change this to simply 
    depend unconditionally on the previous recipe:

        :0A:

There is an alternate way of writing the two recipes; not necessarily 
"simplified", but it may make the meaning of the two recipes more obvious:

        :0
        * ^From.*someone
        {
                :0c
                ! address(_at_)otherhost(_dot_)com

                :0:
                Someone
        }

As for adding the "X-Loop" header...the following recipe will add an 
X-Loop header to any message, and then pass the message on for processing 
by other recipes (make sure that formail is in your path).

        :0 Whf
        | formail -A "X-Loop: $LOGNAME(_at_)$HOST"

You could put this at the top of the nesting block (above) if you just 
wanted it to effect messages from "someone".

-- Lars

---
Lars Kellogg-Stedman * lars(_at_)bu(_dot_)edu * (617)353-8277
Office of Information Technology, Boston University

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