procmail
[Top] [All Lists]

Re: procmail recipe

1998-10-05 11:25:59
Brian Gold--
I have a list of email forwarding recipes with a default recipe at the end.
I copy each recipe to check for CC or BCC in the next recipe, but I only
want the default to execute if none of the above recipes have executed.

Example:

:0 c
* (^TO|^CC|^BCC|^RECEIVED)(_dot_)*brian(_at_)reedycreek(_dot_)com
! bkgold(_at_)mindspring(_dot_)com

:0
* (^TO|^CC|^BCC|^RECEIVED)(_dot_)*neal(_at_)reedycreek(_dot_)com
! nealdavis(_at_)mindspring(_dot_)com

#------DEFAULT---------
:0
! bkgold(_at_)mindspring(_dot_)com


This recipe causes all emails to go to the default even if they have
already been forwarded.  I need to be able to know if any previous recipes
have been executed and only execute the default if none of the other
recipes were executed.

The simplest way to deal with this is to simply delete the first recipe,
which is redundant, and put an E flag (which means "Execute this recipe if
the previous recipe's conditions were not met.") after the :0 on your last
recipe. Your desired conditions boil down to this: "if it is sent to neal,
forward it to neal's other address. Otherwise send it to me."

Also, you might want to the handy TO_neal construction instead of
enumerating those headers as you do. I don't think you can even match on
BCCs, btw.

Cheers,

    Adam Rice |  adamrice(_at_)crossroads(_dot_)net  | Check out
Austin TX USA | http://www.crossroads.net | XJ: Translation Jobs

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