On Fri 02/Sep/2016 07:26:12 +0200 Milan Obuch wrote:
> On Thu, 1 Sep 2016 20:57:50 -0400 David Niklas wrote:
> 
>> I wanted to know if courier could read the subject/from metadata so
>> that it could place courier mailing list mail into one folder and so
>> on with other mail received.
> 
> simplest method would be using maildrop recipe for this user. It comes
> into play after determining mailbox/home directory for mail being
> delivered if configured so. Maildrop recipes are easy to read
> resembling common programming languages or scripts.
> 
> You nead just configure courier to use it, either with .courier if
> maildrop should be used only for said user, or setting DEFAULTDELIVERY
> in courierd config file for all users.
> 
> If you would like to sort mails from this mailing list into defined
> folder, then use List-Id header as selection criterium:
> 
> if (/^List-Id:.*courier-users.lists.sourceforge.net/)
>  to "$HOME/Maildir/$FOLDER/"
> 
> (use desired folder name instead on $FOLDER, I use - for this list -
> .Software.Courier.courier-users).

An obvious generalization, to avoid editing $HOME/.mailfilter on every new 
subscription:

if (/^List-ID:[^<]*<([-_A-Za-z0-9]*)/)
{
        DEST=`sed -nr 's/^INBOX(\\.'"$MATCH1"')$/\\1/ip' 
./Maildir/courierimapsubscribed`
        if ("$DEST")
        {
                `test -d "./Maildir/$DEST"`
                if ($RETURNCODE == 0)
                        to "./Maildir/$DEST";
        }
}


Note that the regex only collects characters up to but excluding the first dot 
(or semicolon, in case of malice), so the 2nd arg to sed would actually be 
"s/^INBOX(\.courier-users)$/\1/ip" for messages in this list.

Ale
-- 











------------------------------------------------------------------------------
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to