[prev in list] [next in list] [prev in thread] [next in thread] 

List:       courier-users
Subject:    Re: [courier-users] More compact mail filtering expression
From:       Bowie Bailey <Bowie_Bailey () BUC ! com>
Date:       2014-05-13 17:02:48
Message-ID: 53725038.4030603 () BUC ! com
[Download RAW message or body]

On 5/13/2014 4:02 AM, Florian Lindner wrote:
> Hello,
>
> I really like the syntax clarity of maildrop compared to e.g. procmail.
> But if I have a long list of Subjects and Senders that should be filed
> in one mailbox it's a lot of writing and clutters the .mailfilter
>
> if (/^Subject: foo$/ || /^Subject: bar$/ || /^From: some@example.org$/
> || ...)
>      to "somewere"
>
> Is there a way to put these rules in an external file? I know about
> lookup, but that matches only one expr againt a set of regexps, I prefer
> something like that:
>
> if (matchfile(filename))
>      to "somewhere"
>
> matchfile is like:
>
> /^Subject: foo$/
> /^Subject: bar$/
> /^From: some@example.org$/
> ...
>
> or that this expression can even return a value:
>
> TARGET = matchfile(filename)
> to "$TARGET"
>
> and matchfile is like:
>
> /^Subject: foo$/, foobar
> /^Subject: bar$/, foobar
> /^From: some@example.org$/, example
> ...
>
> so that is returns foobar or target, based on the match. Is something
> like that, preferably the latter, possible to maildrop?

I don't know of a way to do exactly what you are asking for.  You can 
use an "include" statement to include filtering instructions from a 
separate file if you want to split things up a bit.  Maybe make separate 
files for different types of filters and then include them all in the 
main .mailfilter file.

You can also use line continuations to break up the lines and make it 
easier to read.

if ( /^Subject: foo$/ || \
     /^Subject: bar$/ || \
     /^From: some@example.org$/ || \
     ...)
     to "somewere"

-- 
Bowie

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic