procmail
[Top] [All Lists]

Re: copying all mail matching a number of recipes to a single folder

2001-12-18 15:45:47
So, i have a number of recipes for all the lists I subscribe to

*^From hylafax
hylafax-li
:0:
* ^From dreamcompany
dream-li
:0:
*^(From fop-user-return-|From www-xsl-fo-request)
fop-li
:0:
*^From owner-majordomo(_at_)power(_dot_)renderx(_dot_)com
xep-li
:0:
*^Mailing-List.*XSL-FO
fop-li
...

But I want to copy each of the mails caught by any of the above
into a single folder in addition to each of the above folders.

Lots of possibilities.

One way would be to deliver a copy of the mail to your single folder if
any of those conditions is met, then apply all your existing recipes:

  :0 c:
  * ^(From (hylafax|dreamcompany|fop-user-return-|\
    From 
www-xsl-fo-request|owner-majordomo(_at_)power(_dot_)renderx(_dot_)com)|\
    Mailing-List.*XSL-FO
  some-folder

  :0 :
  * ^From hylafax
  hylafax-li

  ...etc...


Alternatively, if you have a lot of recipes with some expensive
conditions (which doesn't seem to be your situation) it might be more
efficient to only apply each condition once and just set a variable to
indicate which mailbox it should be delivered to.  Something like:

  MYFOLDER=
  :0
  * ^From hylafax
  { MYFOLDER=hylafax-li }

  :0
  * ^From dreamcompany
  { MYFOLDER=dream-li }

  ...etc...

  :0
  * ^Mailing-List.*XSL-FO
  { MYFOLDER=fop-li }

  :0
  * MYFOLDER ?? .
  {
    :0 c:
    $MYFOLDER

    :0:
    some-folder
  }

That last recipe checks to see if $MYFOLDER has been set, and if it has
it delievers a copy of the mail to the folder named in $MYFOLDER, then
deliveres to 'some-folder'.

Note that whereever you have something like "From hylafax" you probably
want to replace that with "From[     ]+hylafax" (with a space and a tab
in the brackets) so that you will accept any number of spaces or tabs
rather than just a single space after the "From".  I was too lazy to
change that in each of the examples above.

Plenty of other methods, also.

Hope that helps,
Martin
-- 
Martin McCarthy                 /</                  PGP key available
    `Procmail Companion'        \>\  http://www.ancient-scotland.co.uk
     Addison Wesley             /</    http://www.ehabitat.demon.co.uk
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail