Re: save to list dir and conditionally to $DEFAULT
Richard Ball <[email protected]>
| Newsgroups | gmane.mail.procmail |
|---|---|
| Message-ID | <[email protected]> |
On Nov 12, 2012, at 3:05 AM, Eric Smith wrote:
> I want all list mail to be saved to the appropriate list folder
> and if they match a pattern in a file, also save to $DEFAULT.
> This is what I am trying, multiple stanzas like these;
>
>
> :0:
> * ^x-mailing-list:([^ ]*\/\<.*)
> {
> :0c
> $LISTDIR/`echo $MATCH|sed -e 's/[@\.>].*//g' -e 's/.*[ <]//' -e
> 's/.*://'`
> :0
> * ? egrep -if /home/eric/serialised_subjects
> $DEFAULT
> }
>
> :0:
> * ^x-list:([^ ]*\/\<.*)
> {
> :0c
> $LISTDIR/`echo $MATCH|sed -e 's/[@\.>].*//g' -e 's/.*[ <]//' -e
> 's/.*://'`
> :0
> * ? egrep -if /home/eric/serialised_subjects
> $DEFAULT
> }
>
> The behaviour without the `c' in :0c is that the mail is only saved in
> the list dir. And with the `c' in :0c, the mail is saved
> MULTIPLE times in list dirs (as it matches more than one list
> regex condition) and one in the $DEFAULT.
>
> What would be the correct implementation?
>
There isn't one correct way. Can you structure your recipes so you determine the proper folder separately from the delivery recipe? Then you just need one delivering recipe which also has the egrep for subjects which, if met, drops a copy into DEFAULT.
Rich