On Mon, 11 Jul 2005, James Polley wrote:

I have a bunch of procmail recipes that pick up mail for various
mailing lists I'm on and dump it to specific folders:

:0:
* [EMAIL PROTECTED]
lists/security/linux-secnews

:0:
* [EMAIL PROTECTED]
lists/SLUG

I'd like for any mail that matches one of these rules to also be
forwarded to my gmail.
<snip>

However, I want this last action to happen if any of the preceding rules ma=
tch

Does anyone know if this is possible?

Hi James,

I use a structure like this, which could be extended to your needs. My requirement is that all amil to a mailing list goes to its box. PLUS, if it is directly to me or didn't land in a mailing list box, then it also goes into my inbox.

The main point is using a variable to mark if it's delivered, then forward or deliver elsewhere at the end depending on the value of the variable. Someone else may have a neater-looking solution though...

The structure is also useful for subfiltering or archiving some lists.

======================================
# This variable is used to mark if a message is delivered
# We deliver to all sub-boxes, but don't repeat anything into inbox
DEL=0

# spam and dupe killing rules go first, and are terminating, but are # excluded from this sample

# Mail directly to me
* ^TO.*(regexp)@my.addresses
{
  DEL=1

  :0 c:
  $DEFAULT
}

# SLUG
:0
* ^Subject.*\[SLUG\]
{
  DEL=1

  :0 c:
  SLUG
}

... (more similar rules) ...

# Everything else will fall through to my inbox
:0
* ? /usr/bin/test $DEL -eq 0
$DEFAULT

# Anything here (DEL != 0) was already delivered to another mailbox
# You would probably not deliver to /dev/null until you are confident of # your rules
:0
*
/dev/null
=====================================

Cheers,

 - Simon
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to